Re: Re: [Zope] manage_afterAdd
From: Chris Withers <lists@simplistix.co.uk> Subject: Re: [Zope] manage_afterAdd Sent: 22 Mar 2004 08:26:59
Well, you say you weren't successful, but you don't say what happened. So, what happened?!
The code I've listed below adds 'dbConnection' as a sibling of the newly instantiated "MyClass" object, but my goal is to have it added as a child. So far my attempts have been unsuccesful. Any suggestions? class MyClass(mxmObjectManager.mxmObjectManager): 'This is the doc string' meta_type='my fake meta type string' id='MyClassInstance' def __init__(self, id): mxmObjectManager.mxmObjectManager.__init__(self, id) def manage_afterAdd(self, containter=None, content=None): self.manage_addZMySQLConnection( id='dbConnection', title = 'dbConnection', connection_string = configFile.DbConnString) def manage_beforeDel(self, container=None, content=None): pass def manage_addAction(self, id=PrinterSite.id, REQUEST=None): 'Add instance to parentObjectManager' mxmObjectManager.addClass(self, id, PrinterSite, REQUEST) Constructors = (mxmObjectManager.manage_addForm, manage_addAction,) Thanks, Poor Yorick zope.org@pooryorick.com
Poor Yorick wrote:
def manage_afterAdd(self, containter=None, content=None): self.manage_addZMySQLConnection( id='dbConnection', title = 'dbConnection', connection_string = configFile.DbConnString)
The above isn't correct ;-) def manage_afterAdd(self, containter=None, content=None): self.manage_addProduct['MySQLDA'].manage_addZMySQLConnection( id='dbConnection', title = 'dbConnection', connection_string = configFile.DbConnString) ...should do what you want. cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
participants (2)
-
Chris Withers -
Poor Yorick