RE: [Zope] Creating an object from within another
I haven't gone back to look at the history of this thread, but it seems you want to call something like; self.manage_addProduct['SimpleSite'].manage_addBasicDocument(id='index_h tml', title='') (manage_addProduct is a mapping of Product name to Product object. as long as you've registered the constructors for SimpleSite in the __init__ of the Product, you should be able to get to them like this). > -Original Message- > From: Daniel Rusch [mailto:[EMAIL PROTECTED]] > Sent: Monday, August 21, 2000 2:15 PM > To: Chris McDonough > Cc: Kapil Thangavelu; Dieter Maurer; [EMAIL PROTECTED] > Subject: Re: [Zope] Creating an object from within another > > > Thanks for the help gentlemen, but I still get the same error mesage: > >Zope Error > > Zope has encountered an error while publishing this resource. > > AttributeError > > Sorry, a Zope error occurred. > > Traceback (innermost last): > File > /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py, > line 214, in > publish_module > File > /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py, > line 179, in > publish > File > /home/Zope-2.1.6-linux2-x86/lib/python/Zope/__init__.py, line 202, in > zpublisher_exception_hook > File > /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py, > line 165, in > publish > File > /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/mapply.py, > line 160, in > mapply > (Object: manage_addSimpleSite) > File > /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py, > line 102, in > call_object > (Object: manage_addSimpleSite) > File > /home/zope/lib/python/Products/SimpleSite/SimpleSite.py, line 72, in > manage_addSimpleSite > AttributeError: manage_addBasicDocument > > Any thoughts, > > DR > > > > Chris McDonough wrote: > > > I think he meant ob.__of__(self) which wraps ob into the context of > > self. Useful for returning unwrapped Python objects while you're in > > Python. > > > > On Fri, 18 Aug 2000, Kapil Thangavelu wrote: > > > > > Dieter Maurer wrote: > > > > > > > > Daniel Rusch writes: > > > > > So far so good, > > > > > > > > > > Next hurdle, at least the problems have been cut > down to hurdles from walls. > > > > > > > > > > I have a folderish product say myFolder, in the > manage_addMyFolder function I > > > > > want to create an object of my product B. so I do this: > > > > > > > > > > def manage_addmyFolder(self, id, title='', > > > > > REQUEST=None): > > > > > """Add a new myFolder object with id *id*. > > > > > """ > > > > > ob=myFolder() > > > > > ob.id=id > > > > > ob.title=title > > > > > self._setObject(id, ob) > > > > > try: user=REQUEST['AUTHENTICATED_USER'] > > > > > except: user=None > > > > > ob.manage_addB(id='index_html', title='') <-- if > I change this to > > > > Try: (ob __of__ self).manage_addB() > > > > > > whats is ob__of__self ??? > > > > > > acquisition at its best? > > > > > > attribute access to get a reference to the ob attr of self? > > > > > > kapil > > > > > > ___ > > > Zope maillist - [EMAIL PROTECTED] > > > http://lists.zope.org/mailman/listinfo/zope > > > ** No cross posts or HTML encoding! ** > > > (Related lists - > > > http://lists.zope.org/mailman/listinfo/zope-announce > > > http://lists.zope.org/mailman/listinfo/zope-dev ) > > > > > > > ___ > > Zope maillist - [EMAIL PROTECTED] > > http://lists.zope.org/mailman/listinfo/zope > > ** No cross posts or HTML encoding! ** > > (Related lists - > > http://lists.zope.org/mailman/listinfo/zope-announce > > http://lists.zope.org/mailman/listinfo/zope-dev ) > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Creating an object from within another
Thanks for the help gentlemen, but I still get the same error mesage: Zope Error Zope has encountered an error while publishing this resource. AttributeError Sorry, a Zope error occurred. Traceback (innermost last): File /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py, line 179, in publish File /home/Zope-2.1.6-linux2-x86/lib/python/Zope/__init__.py, line 202, in zpublisher_exception_hook File /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py, line 165, in publish File /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: manage_addSimpleSite) File /home/Zope-2.1.6-linux2-x86/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: manage_addSimpleSite) File /home/zope/lib/python/Products/SimpleSite/SimpleSite.py, line 72, in manage_addSimpleSite AttributeError: manage_addBasicDocument Any thoughts, DR Chris McDonough wrote: > I think he meant ob.__of__(self) which wraps ob into the context of > self. Useful for returning unwrapped Python objects while you're in > Python. > > On Fri, 18 Aug 2000, Kapil Thangavelu wrote: > > > Dieter Maurer wrote: > > > > > > Daniel Rusch writes: > > > > So far so good, > > > > > > > > Next hurdle, at least the problems have been cut down to hurdles from walls. > > > > > > > > I have a folderish product say myFolder, in the manage_addMyFolder function I > > > > want to create an object of my product B. so I do this: > > > > > > > > def manage_addmyFolder(self, id, title='', > > > > REQUEST=None): > > > > """Add a new myFolder object with id *id*. > > > > """ > > > > ob=myFolder() > > > > ob.id=id > > > > ob.title=title > > > > self._setObject(id, ob) > > > > try: user=REQUEST['AUTHENTICATED_USER'] > > > > except: user=None > > > > ob.manage_addB(id='index_html', title='') <-- if I change this to > > > Try: (ob __of__ self).manage_addB() > > > > whats is ob__of__self ??? > > > > acquisition at its best? > > > > attribute access to get a reference to the ob attr of self? > > > > kapil > > > > ___ > > Zope maillist - [EMAIL PROTECTED] > > http://lists.zope.org/mailman/listinfo/zope > > ** No cross posts or HTML encoding! ** > > (Related lists - > > http://lists.zope.org/mailman/listinfo/zope-announce > > http://lists.zope.org/mailman/listinfo/zope-dev ) > > > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Creating an object from within another
Kapil Thangavelu writes: > Dieter Maurer wrote: > > Try: (ob __of__ self).manage_addB() > > whats is ob__of__self ??? > > acquisition at its best? No, it was simply too late in the day. It should have been "(ob.__of__(self)).manage_addB(...)". The "ob.__of__(self)" is "ob" in the context of "self". Dieter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Creating an object from within another
I think he meant ob.__of__(self) which wraps ob into the context of self. Useful for returning unwrapped Python objects while you're in Python. On Fri, 18 Aug 2000, Kapil Thangavelu wrote: > Dieter Maurer wrote: > > > > Daniel Rusch writes: > > > So far so good, > > > > > > Next hurdle, at least the problems have been cut down to hurdles from walls. > > > > > > I have a folderish product say myFolder, in the manage_addMyFolder function I > > > want to create an object of my product B. so I do this: > > > > > > def manage_addmyFolder(self, id, title='', > > > REQUEST=None): > > > """Add a new myFolder object with id *id*. > > > """ > > > ob=myFolder() > > > ob.id=id > > > ob.title=title > > > self._setObject(id, ob) > > > try: user=REQUEST['AUTHENTICATED_USER'] > > > except: user=None > > > ob.manage_addB(id='index_html', title='') <-- if I change this to > > Try: (ob __of__ self).manage_addB() > > whats is ob__of__self ??? > > acquisition at its best? > > attribute access to get a reference to the ob attr of self? > > kapil > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Creating an object from within another
Dieter Maurer wrote: > > Daniel Rusch writes: > > So far so good, > > > > Next hurdle, at least the problems have been cut down to hurdles from walls. > > > > I have a folderish product say myFolder, in the manage_addMyFolder function I > > want to create an object of my product B. so I do this: > > > > def manage_addmyFolder(self, id, title='', > > REQUEST=None): > > """Add a new myFolder object with id *id*. > > """ > > ob=myFolder() > > ob.id=id > > ob.title=title > > self._setObject(id, ob) > > try: user=REQUEST['AUTHENTICATED_USER'] > > except: user=None > > ob.manage_addB(id='index_html', title='') <-- if I change this to > Try: (ob __of__ self).manage_addB() whats is ob__of__self ??? acquisition at its best? attribute access to get a reference to the ob attr of self? kapil ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Creating an object from within another
Daniel Rusch writes: > So far so good, > > Next hurdle, at least the problems have been cut down to hurdles from walls. > > I have a folderish product say myFolder, in the manage_addMyFolder function I > want to create an object of my product B. so I do this: > > def manage_addmyFolder(self, id, title='', > REQUEST=None): > """Add a new myFolder object with id *id*. > """ > ob=myFolder() > ob.id=id > ob.title=title > self._setObject(id, ob) > try: user=REQUEST['AUTHENTICATED_USER'] > except: user=None > ob.manage_addB(id='index_html', title='') <-- if I change this to Try: (ob __of__ self).manage_addB() Dieter ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Creating an object from within another
Yeah, that's what i thought, but I know it exists cause I can create an object of type B and I copied and pasted the manage_addB part? For any one else who is reading this: the problem is: I have a product I'll call B. Additionally I have a folderish product I'll call myFolder. What I want to do is when I create a folderish object (a myFolder) in it I want an object B, very similar to when a folder is created you can have a DTMLMethod created. And here is the rub, I am able to have my folderish object create a DTMLMethod instead of an object B. Any thoughts, Dan Andy McKay wrote: > Not to sure there Im afraid. The obvious answer is the manage_addB doesnt > exist whereas manage_addDTMLDocument does. > > -- > Andy McKay, Developer, ActiveState > http://www.ActiveState.com > Programming for the People > > - Original Message - > From: "Daniel Rusch" <[EMAIL PROTECTED]> > To: "Daniel Rusch" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Thursday, August 17, 2000 1:39 PM > Subject: [Zope] Creating an object from within another > > > So far so good, > > > > Next hurdle, at least the problems have been cut down to hurdles from > walls. > > > > I have a folderish product say myFolder, in the manage_addMyFolder > function I > > want to create an object of my product B. so I do this: > > > > def manage_addmyFolder(self, id, title='', > > REQUEST=None): > > """Add a new myFolder object with id *id*. > > """ > > ob=myFolder() > > ob.id=id > > ob.title=title > > self._setObject(id, ob) > > try: user=REQUEST['AUTHENTICATED_USER'] > > except: user=None > > ob.manage_addB(id='index_html', title='') <-- if I change this to > > ob.manage_addDTMLDocument(id='index_html', title='') that works ? > > ... > > > > I get the following error: > > > > AttributeError: manage_addB > > > > > > > > Any thoughts, > > > > DR > > > > > > > > > > > > ___ > > Zope maillist - [EMAIL PROTECTED] > > http://lists.zope.org/mailman/listinfo/zope > > ** No cross posts or HTML encoding! ** > > (Related lists - > > http://lists.zope.org/mailman/listinfo/zope-announce > > http://lists.zope.org/mailman/listinfo/zope-dev ) > > > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] Creating an object from within another
Not to sure there Im afraid. The obvious answer is the manage_addB doesnt exist whereas manage_addDTMLDocument does. -- Andy McKay, Developer, ActiveState http://www.ActiveState.com Programming for the People - Original Message - From: "Daniel Rusch" <[EMAIL PROTECTED]> To: "Daniel Rusch" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, August 17, 2000 1:39 PM Subject: [Zope] Creating an object from within another > So far so good, > > Next hurdle, at least the problems have been cut down to hurdles from walls. > > I have a folderish product say myFolder, in the manage_addMyFolder function I > want to create an object of my product B. so I do this: > > def manage_addmyFolder(self, id, title='', > REQUEST=None): > """Add a new myFolder object with id *id*. > """ > ob=myFolder() > ob.id=id > ob.title=title > self._setObject(id, ob) > try: user=REQUEST['AUTHENTICATED_USER'] > except: user=None > ob.manage_addB(id='index_html', title='') <-- if I change this to > ob.manage_addDTMLDocument(id='index_html', title='') that works ? > ... > > I get the following error: > > AttributeError: manage_addB > > > > Any thoughts, > > DR > > > > > > ___ > Zope maillist - [EMAIL PROTECTED] > http://lists.zope.org/mailman/listinfo/zope > ** No cross posts or HTML encoding! ** > (Related lists - > http://lists.zope.org/mailman/listinfo/zope-announce > http://lists.zope.org/mailman/listinfo/zope-dev ) > ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
[Zope] Creating an object from within another
So far so good, Next hurdle, at least the problems have been cut down to hurdles from walls. I have a folderish product say myFolder, in the manage_addMyFolder function I want to create an object of my product B. so I do this: def manage_addmyFolder(self, id, title='', REQUEST=None): """Add a new myFolder object with id *id*. """ ob=myFolder() ob.id=id ob.title=title self._setObject(id, ob) try: user=REQUEST['AUTHENTICATED_USER'] except: user=None ob.manage_addB(id='index_html', title='') <-- if I change this to ob.manage_addDTMLDocument(id='index_html', title='') that works ? ... I get the following error: AttributeError: manage_addB Any thoughts, DR ___ Zope maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )