[Zope-dev] Intializing the objects formerly-known-as-RackMountables

Phillip J. Eby pje@telecommunity.com
Wed, 19 Jul 2000 08:10:56 -0500


At 12:42 PM 7/19/00 +0300, Itamar Shtull-Trauring wrote:
>I need to do initialize some properties of new instances of a DataSkin
>subclass - ASPAccount.  However, I can't put this in __init__ since the
>object hasn't been stored at that point.  
>
>Doing self.__dict__['name'] = 'Rincewind' seems kinda ugly.  Maybe newItem
>should by default call a function on newly created objects, say __init?  I
>don't want to have to subclass Specialist (or in my case, LoginManager) each
>time I want to this, since it's a *very* common action.  For example,

Could you give a more specific example?  My assumption is that if you need
to have things happen upon adding, that one uses a trigger to do it.  Or,
if the data is specific to that instance, then the appropriate thing would
be to manipulate properties or attributes in the code that calls newItem().

Also, it isn't necessary to subclass the specialist -- you don't have to
call your routine newItem(), after all.  newUser() would be a better choice
of name for the method, it sounds like.