don't overwrite the map function with reduce! twisty
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 10 Mar 2009 17:48:13 +1100
branchtwisty
changeset 69 057aae263c27cf40b957c1652b663e6f2d6f8d51
parent 68 c03e660107daac3a5c4fbad2680daef697e702c5
child 70 557ef1b824258f490a54d08545b90b9d88cf746b
push id1
push userroot
push dateWed, 08 Apr 2009 01:46:05 +0000
don't overwrite the map function with reduce!
server/python/junius/model.py
--- a/server/python/junius/model.py
+++ b/server/python/junius/model.py
@@ -292,22 +292,23 @@ def _build_doc_from_directory(ddir):
                 ret_views[view_name] = {'map': f.read()}
             finally:
                 f.close()
         except (OSError, IOError):
             logger.info("can't open map.js in view directory %r - skipping entire document", view_dir)
             continue
         try:
             f = open(os.path.join(view_dir, 'reduce.js'))
-            ret_views[view_name] = {'reduce': f.read()}
+            ret_views[view_name]['reduce'] = f.read()
             f.close()
         except (OSError, IOError):
             # no reduce - no problem...
             logger.debug("no reduce.js in '%s' - skipping reduce for this view", view_dir)
             continue
+    logger.info("Document in directory %r has views %s", ddir, ret_views.keys())
     if not ret_views:
         logger.warning("Document in directory %r appears to have no views", ddir)
     return ret
 
 
 def generate_designs_from_filesystem(root):
     # This is pretty dumb (but therefore simple).
     # root/* -> directories used purely for a 'namespace'