[
https://issues.apache.org/jira/browse/COUCHDB-959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jan Lehnardt closed COUCHDB-959.
--------------------------------
Resolution: Fixed
Fix Version/s: 1.2
1.1
> runProvides should set this to design doc for show and list funcs
> -----------------------------------------------------------------
>
> Key: COUCHDB-959
> URL: https://issues.apache.org/jira/browse/COUCHDB-959
> Project: CouchDB
> Issue Type: Bug
> Components: JavaScript View Server
> Affects Versions: 1.0.1
> Environment: N/A
> Reporter: Timothy Smith
> Priority: Minor
> Fix For: 1.1, 1.2
>
> Attachments: provides-this.patch
>
> Original Estimate: 0.5h
> Remaining Estimate: 0.5h
>
> The Javascript query server's runProvides() function currently calls the
> functions with this referencing the sandbox object. Instead, it should
> reference the design doc object, the same as in the outer show or list
> function.
> Patch to fix:
> https://github.com/couchtim/couchdb/commit/49cca724cb3aa76de339f55827e84259bf2da6ea
> A workaround for now is to save the value of this in the outer function, like:
> lists: { foo: function(head, req) { var that = this; provides('html',
> function() { var value_from_ddoc = that.some_value; }); } }
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira