summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lehnardt <jan@apache.org>2011-04-17 12:53:58 +0000
committerJan Lehnardt <jan@apache.org>2011-04-17 12:53:58 +0000
commitb0a71bc31a892d9499f91501d9a634ce356b11c0 (patch)
tree9aabc59674063cbc034d3fdf11c6e03bdba57ccc
parent5f5f3baf2e48ef14a5272c3d1e4e9ac444d11e7c (diff)
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. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1094140 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--THANKS1
-rw-r--r--share/server/render.js8
2 files changed, 5 insertions, 4 deletions
diff --git a/THANKS b/THANKS
index 0f83e263..27d0f420 100644
--- a/THANKS
+++ b/THANKS
@@ -76,5 +76,6 @@ suggesting improvements or submitting changes. Some of these people are:
* 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.
diff --git a/share/server/render.js b/share/server/render.js
index 9dcfbcd6..d207db41 100644
--- a/share/server/render.js
+++ b/share/server/render.js
@@ -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") {