Re: [Modeling-users] Problems importing Modeling with ZODB 3.1.1 installed
Status: Abandoned
Brought to you by:
sbigaret
From: Ernesto R. <er...@si...> - 2003-09-16 22:37:55
|
Hi again, what is the consequence of having ZODB standalone installed when using = Modeling? Are there any important differences between = Persistence.Persistent and Persistent.Persistent? regards, Erny ----- Original Message -----=20 From: "Sebastien Bigaret" <sbi...@us...> To: "Ernesto Revilla" <er...@si...> Cc: "modeling-users" <mod...@li...> Sent: Tuesday, September 16, 2003 10:34 PM Subject: Re: [Modeling-users] Problems importing Modeling with ZODB = 3.1.1 installed Hi Erny, Oh my, I think this bug was already reported quite a long time ago by Soaf, and I completely forgot about it. You can safely comment the last line of Entity.py: finalize_docstrings() is absolutely useless wrt the runtime, it only updates some docstrings with a common pattern. I made this when investigating some methods to share documentation in docstrings, but this is definitely not the way to do this, and it shouldn't have been integrated into the main trunk. I'll remove this in the next release. Thanks a lot for reporting, and sorry for the inconvenience. -- S=E9bastien. PS: BTW, Entity, Model, etc. inherits from ZODB.Persistent because of the ZModeler, which uses them as-is; this allows them to remain persistent in a zope instance, so you don't want to disable this if you use the ZModeler. "Ernesto Revilla" <er...@si...> wrote: > Hi, > just a little note if this issue haven't arosen yet. >=20 > I've standalone ZODB 3.1.1 installed, running under Python 2.2 / = Win32. >=20 > When I do a=20 > from Modeling.PyModel import * >=20 > I get the following error: > File "<stdin>", line 1, in ? > File "c:\prg\python22\Lib\site-packages\Modeling\PyModel.py", line = 57, in ? > from Entity import externalNameForInternalName > File "c:\prg\python22\Lib\site-packages\Modeling\Entity.py", line = 1442, in ? > finalize_docstrings(Entity, ENTITY_DOC) > File "c:\prg\python22\Lib\site-packages\Modeling\utils.py", line = 166, in finalize_docstrings > for n,m in inspect.getmembers(klass, inspect.ismethod): > File "c:\prg\python22\lib\inspect.py", line 161, in getmembers > value =3D getattr(obj, key) > AttributeError: __call__ >=20 > In Entity.py, Entity will now be a extension class, because of = Persistent (which is cPersistence.Persistent) and dir exposes an = attribute __call__, that when doing a getattr(Entity,'__call__') fails = in inspect.getmembers, inside the Python standard lib. >=20 > To circumvate this I put a quick and dirty: > raise 'Don't use ZODB'=20 >=20 > near line 113 of Entity.py, in order to avoid ZODB Persistence = mechanism. Perhaps, this is a bug in Python 2.2 because: > >>> import ZODB > >>> from Persistence import Persistent > >>> dir(Persistent) > ['__basicnew__', '__call__', '__changed__', '__delattr__', '__doc__', = '__getattr__', '__getstate__', '__init__', '__module__', '__reduce__', = '__repr__', '__setattr__', '__setstate__', '_p_deactivate', = 'inheritedAttribute'] > >>> getattr(Persistent,'__call__') > Traceback (most recent call last): > File "<interactive input>", line 1, in ? > AttributeError: __call__ > >>> >=20 > I'll try Python 2.2.3 and tell you if the error persist. >=20 > Erny |