Document.view('viewname') causes wrap error due to new behaviour since 0.6.2

33 views
Skip to first unread message

Iurii Garmash

unread,
Sep 30, 2014, 1:53:56 PM9/30/14
to couch...@googlegroups.com
I am working with a couchdbkit Document object like this:

    class MyDoc(Document):
        property = ...


I want to fetch this document with a list of properties:

    all_docs = MyDoc.view('db/myview')

And having the view results object like this brings an exception while iterating over it.

DocTypeError
Exception Value:
the document being wrapped has doc type None. To wrap it anyway, you must explicitly pass in classes={None: <document class>} to your view. This behavior is new starting in 0.6.2.
I have add the explicit class declaration.

     all_docs = MyDoc.view('db/myview', classes={None: MyDoc})

This was ok for fetching all the docs.

However I was fetching docs providing key's for the view like so:

    all_docs = MyDoc.view(
        'db/myview', 
        classes={None: MyDoc},
        key=property
    )

Now this construction seem to have stop working.

Attention Question! :)

Am I querying this in a right manner?
Maybe new functionality did provide another method to do this kind of stuff?
Reply all
Reply to author
Forward
0 new messages