[TransWarp] Is there a problem with module Inheritance ??
Ulrich Eck
ueck at net-labs.de
Wed Mar 27 11:56:26 EST 2002
Hi Philip,
i followed your example to use a specialist and found out the following:
when i code as you suggested in your first mail from 18.03.2002:
MyDomainLayer.py:
---------------------------------------------------------------------------
from TW.API import *
class User(SEF.Element):
class dn(SEF.Field):
pass
class cn(SEF.Field):
pass
class Users(SEF.Specialist):
def dosomething(self,text):
print "i do: " + text
setupModule()
---------------------------------------------------------------------------
MyDispatchLayer.py
---------------------------------------------------------------------------
from TW.API import *
import MyDomainLayer
__bases__ = MyDomainLayer,
class User:
class dn:
pass
class cn:
pass
class Users:
elementClass = User
recordManager = SEF.bindTo('MyDatabase.Accounts')
requiredType = 'PosixAccount'
keyField = 'uid'
setupModule()
---------------------------------------------------------------------------
i get the following error when i use it:
...
File "/usr/lib/python2.2/site-packages/TW/SEF/Basic.py", line 459, in
__getitem__
item = self._retrieveItem(key)
File "/usr/lib/python2.2/site-packages/TW/SEF/Basic.py", line 521, in
_retrieveItem
return self._wrapElement(record)
File "/usr/lib/python2.2/site-packages/TW/SEF/Basic.py", line 530, in
_wrapElement
element._setSEFparent(self)
AttributeError: User instance has no attribute '_setSEFparent'
when I put
elementClass = User
into MyDomainLayer and remove it from MyDispatchLayer everything works fine.
shouldn't the rebuilt classes be replaced by name in all modules ???
or did i just get something wrong with module-inheritance ??
Ulrich Eck
---------------------------------------------------------------------------
net-labs Systemhaus GmbH
Ebersberger Str. 46
85570 Markt Schwaben
fon: +49-8121-4747-11
fax: +49-8121-4747-77
email: ueck at net-labs.de
http://www.net-labs.de
More information about the PEAK
mailing list