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