couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1094140 - in /couchdb/branches/1.1.x: THANKS share/server/render.js
Date Sun, 17 Apr 2011 12:53:59 GMT
Author: jan
Date: Sun Apr 17 12:53:58 2011
New Revision: 1094140

URL: http://svn.apache.org/viewvc?rev=1094140&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/branches/1.1.x/THANKS
    couchdb/branches/1.1.x/share/server/render.js

Modified: couchdb/branches/1.1.x/THANKS
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/THANKS?rev=1094140&r1=1094139&r2=1094140&view=diff
==============================================================================
--- couchdb/branches/1.1.x/THANKS (original)
+++ couchdb/branches/1.1.x/THANKS Sun Apr 17 12:53:58 2011
@@ -76,5 +76,6 @@ suggesting improvements or submitting ch
  * Gabriel Farrell <gsf747@gmail.com>
  * Mike Leddy <mike@loop.com.br>
  * Felix Hummel <apache@felixhummel.de>
+ * Tim Smith <tim@couchbase.com>
 
 For a list of authors see the `AUTHORS` file.

Modified: couchdb/branches/1.1.x/share/server/render.js
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/share/server/render.js?rev=1094140&r1=1094139&r2=1094140&view=diff
==============================================================================
--- couchdb/branches/1.1.x/share/server/render.js (original)
+++ couchdb/branches/1.1.x/share/server/render.js Sun Apr 17 12:53:58 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]});
       throw(["error","not_acceptable",
@@ -233,7 +233,7 @@ var Render = (function() {
       }
 
       if (Mime.providesUsed) {
-        resp = Mime.runProvides(args[1]);
+        resp = Mime.runProvides(args[1], ddoc);
         resp = applyContentType(maybeWrapResponse(resp), Mime.responseContentType);
       }
 
@@ -287,7 +287,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