Uploaded image for project: 'CouchDB'
  1. CouchDB
  2. COUCHDB-959

runProvides should set this to design doc for show and list funcs

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.0.1
    • 1.1, 1.2
    • JavaScript View Server
    • None
    • N/A

    • New Contributors Level (Easy)

    Description

      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; }

      ); } }

      Attachments

        1. provides-this.patch
          2 kB
          Timothy Smith

        Activity

          People

            Unassigned Unassigned
            tim@couchio Timothy Smith
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0.5h
                0.5h
                Remaining:
                Remaining Estimate - 0.5h
                0.5h
                Logged:
                Time Spent - Not Specified
                Not Specified