>any mapped class may define whatever __init__ method it wants. while
>assign_mapper provides a default __init__ method for classes, if the class
>already has an __init__ method then that one will be used (just check out
>assignmapper.py to see).
Thanks. So, to achieve initializations in business objects, I am following
this pattern:
# base class for all business objects
class BOBase(object):
def __init__(self, **kwargs): # I copied this code
for key, value in kwargs.items(): # from assignmapper.py
setattr(self, key, value) #
class SampleBO(BOBase):
def __init__(self, **kwargs):
super(SampleBO, self).__init__(**kwargs) # calling super's
__init__
#custom initializations, if any
self.xyz = abc;
.
.
.
This works. Any comments whether this is a good way, or any better way is
recommended, will help.
Thanks
Sanjay
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users