durusmail: durus-users: README example does not work
README example does not work
2004-07-31
2004-07-31
RELEASED: Durus 1.0
2004-07-31
unable to persist stuff from client.py with 1 character python filename?
2004-07-31
Re: unable to persist stuff from client.py with 1 character python filename?
2004-07-31
README example does not work
Jon Dyte
2004-07-31
I found this too. It is better to define the persistent class in a separate
python file and import it if you want to test interactively
----a.py----

from durus.persistent import Persistent

class A(Persistent):
        pass
-----------

then interactively you can do

from a import A
x = A()
root['sample]'=x
connection.commit()

Jon


On Saturday 31 July 2004 09:57, Ludovico Magnocavallo wrote:
> The example of subclassing Persistent in the README does not work:
>  >>> connection
>
> 
>
>  >>> root
>
> 
>
>  >>> class A(Persistent):
>
> .....  pass
> .....
>
>  >>> x = A()
>  >>> root["sample"] = x
>  >>> root['sample']
>
> 
>
>  >>> connection.commit()
>
> Traceback (most recent call last):
>    File "", line 1, in ?
>    File "/usr/lib/python2.3/site-packages/durus/connection.py", line
> 227, in commit
>      data, refs = writer.get_state(obj)
>    File "/usr/lib/python2.3/site-packages/durus/serialize.py", line 108,
> in get_state
>      self.pickler.dump(obj.__getstate__())
> PicklingError: Can't pickle : attribute lookup __builtin__.A
> failed
>
>
> What am I missing?
>
> Ludo
> _______________________________________________
> Durus-users mailing list
> Durus-users@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/durus-users


reply