Re: [Tutor] couchdb.mapping 'Document' class

2011-03-01 Thread Knacktus

Am 01.03.2011 16:19, schrieb Emanuel Lauria:

Hi everyone,

I'm trying to map a couchdb document to a python object using
couchdb.mapping. I'm stuck in the very first part were it says I should
declare a Python class that inherits from the 'Document'.. Where does
this 'Document' superclass comes from? I can't resolve it. Or do I have
to create it? How? Could someone point me in to the right direction?

 >>> import couchdb

 >>> class Person(Document):
... name = TextField()
...
Traceback (most recent call last):
File "", line 1, in 
NameError: name 'Document' is not defined



It looks like the class Document is located in the module couchdb.client 
(it's chapter 3.3).

This should work:

import couchdb.client

class Person(couchdb.client.Document):

...

HTH

Jan



Thanks for your help, and please forgive me if im too n00b in this. I
havent found any documentation except
http://packages.python.org/CouchDB/mapping.html which is not enough.

Thanks



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] couchdb.mapping 'Document' class

2011-03-01 Thread Emanuel Lauria
Hi everyone,

I'm trying to map a couchdb document to a python object using couchdb.mapping. 
I'm stuck in the very first part were it says I should declare a Python class 
that inherits from the 'Document'.. Where does this 'Document' superclass comes 
from? I can't resolve it. Or do I have to create it? How? Could someone point 
me in to the right direction?

>>> import couchdb

>>> class Person(Document):
... name = TextField()
... 
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'Document' is not defined


Thanks for your help, and please forgive me if im too n00b in this. I havent 
found any documentation except http://packages.python.org/CouchDB/mapping.html 
which is not enough.

Thanks___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor