You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Timothy Smith (JIRA)" <ji...@apache.org> on 2010/11/22 10:17:13 UTC

[jira] Created: (COUCHDB-959) runProvides should set this to design doc for show and list funcs

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


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.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-959) runProvides should set this to design doc for show and list funcs

Posted by "Timothy Smith (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-959?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Smith updated COUCHDB-959:
----------------------------------

    Attachment: provides-this.patch

Patch for this issue

> 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
>         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.
-
You can reply to this email to add a comment to the issue online.


[jira] [Closed] (COUCHDB-959) runProvides should set this to design doc for show and list funcs

Posted by "Jan Lehnardt (JIRA)" <ji...@apache.org>.
     [ 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