couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1094137 - in /couchdb/trunk: THANKS share/server/render.js
Date Sun, 17 Apr 2011 12:52:54 GMT
Author: jan
Date: Sun Apr 17 12:52:53 2011
New Revision: 1094137

URL: http://svn.apache.org/viewvc?rev=1094137&view=rev
Log:
Make this reference ddoc in provides() functions

In show and list functions in the Javascript query server, the this
member is a reference to the design doc object. The same should be true
in the functions registered by Mime.provides(), for consistency.

Closes COUCHDB-959

Patch by Tim Smith.

Modified:
    couchdb/trunk/THANKS
    couchdb/trunk/share/server/render.js

Modified: couchdb/trunk/THANKS
URL: http://svn.apache.org/viewvc/couchdb/trunk/THANKS?rev=1094137&r1=1094136&r2=1094137&view=diff
==============================================================================
--- couchdb/trunk/THANKS (original)
+++ couchdb/trunk/THANKS Sun Apr 17 12:52:53 2011
@@ -78,5 +78,6 @@ suggesting improvements or submitting ch
  * Wayne Conrad <wayne@databill.com>
  * Thomas Vander Stichele <thomas@apestaart.org>
  * Felix Hummel <apache@felixhummel.de>
+ * Tim Smith <tim@couchbase.com>
 
 For a list of authors see the `AUTHORS` file.

Modified: couchdb/trunk/share/server/render.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/render.js?rev=1094137&r1=1094136&r2=1094137&view=diff
==============================================================================
--- couchdb/trunk/share/server/render.js (original)
+++ couchdb/trunk/share/server/render.js Sun Apr 17 12:52:53 2011
@@ -72,7 +72,7 @@ var Mime = (function() {
     Mime.responseContentType = null;  
   };
 
-  function runProvides(req) {
+  function runProvides(req, ddoc) {
     var supportedMimes = [], bestFun, bestKey = null, accept = req.headers["Accept"];
     if (req.query && req.query.format) {
       bestKey = req.query.format;
@@ -103,7 +103,7 @@ var Mime = (function() {
     };
 
     if (bestFun) {
-      return bestFun();
+      return bestFun.call(ddoc);
     } else {
       var supportedTypes = mimeFuns.map(function(mf) {
         return mimesByKey[mf[0]].join(', ') || mf[0];
@@ -234,7 +234,7 @@ var Render = (function() {
       }
 
       if (Mime.providesUsed) {
-        resp = Mime.runProvides(args[1]);
+        resp = Mime.runProvides(args[1], ddoc);
         resp = applyContentType(maybeWrapResponse(resp), Mime.responseContentType);
       }
 
@@ -288,7 +288,7 @@ var Render = (function() {
       var tail = listFun.apply(ddoc, args);
 
       if (Mime.providesUsed) {
-        tail = Mime.runProvides(req);
+        tail = Mime.runProvides(req, ddoc);
       }    
       if (!gotRow) getRow();
       if (typeof tail != "undefined") {



Mime
View raw message