I _still_ need help on ZClasses and manage_clone
I'm banging my head on the wall for this. I have a ZClass which derives from Folder, and has permissons for "Documents, Images and Files". When I try to use manage_clone within an instance of it, I get Error Type: AttributeError Error Value: _getProducts [...] Traceback (innermost last): File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 179, in publish File /usr/lib/zope/lib/python/Zope/__init__.py, line 202, in zpublisher_exception_hook (Object: ElementWithAttributes) File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 165, in publish File /usr/lib/zope/lib/python/ZPublisher/mapply.py, line 160, in mapply (Object: PuploadMenu) File /usr/lib/zope/lib/python/ZPublisher/Publish.py, line 102, in call_object (Object: PuploadMenu) File /usr/lib/zope/lib/python/Products/ExternalMethod/ExternalMethod.py, line 248, in __call__ (Object: PuploadMenu) (Info: ((<Folder instance at 85b2328>, <h3>form</h3> [...] File /var/lib/zope/Extensions/upload.py, line 143, in uploadMenu (Object: ElementWithAttributes) File /var/lib/zope/Extensions/upload.py, line 70, in NewArticolo (Object: ElementWithAttributes) File /usr/lib/zope/lib/python/OFS/CopySupport.py, line 284, in manage_clone (Object: ElementWithAttributes) File /usr/lib/zope/lib/python/OFS/CopySupport.py, line 353, in _verifyObjectPaste (Object: ElementWithAttributes) File /usr/lib/zope/lib/python/App/FactoryDispatcher.py, line 96, in __getitem__ AttributeError: (see above) This is the relevant section of upload.py, where "gruppo" is a list of Image names. "self" is the folder containing 'upload', which is a folder full of Images. def NewArticolo(self,REQUEST,RESPONSE): r='' gruppo = REQUEST.form.get('gruppo') if gruppo: next_art = self['prossimo_articolo'] # property of folder 'foto' upload=self.upload.this() id = 'art_%s'%next_art newob = upload.Control_Panel.Products.MArticolo.ArtClass(id) newob.id = id # newob.propertysheets.art_info.manage_changeProperties(REQUEST) upload._setObject(id,newob) r=r+ 'Articolo %s aggiunto.<BR>' % next_art next_art = next_art + 1 next_foto = self['prossima_foto'] for i in gruppo: # upload.manage_clone(upload[i],'foto_%s'%next_foto) # ^^^^^^^ this works newob.manage_clone(upload[i],'foto_%s'%next_foto) ^^^^^^^ this doesn't newob["foto_%s"%next_foto].manage_changeProperties({'filename': i}) r=r+ 'Foto %s aggiunta.<BR>' % i next_foto = next_foto + 1 self.manage_changeProperties({'prossimo_articolo': next_art}) self.manage_changeProperties({'prossima_foto': next_foto}) return r Thank you for reading this far.
Marco, still I don't see why you would use an external method for the functions below. When I started zoping, I did far too much in external methods because I didn't know that DTML does it too. My proposal: get my ListMate product and have a look at it. It does a lot with manage_upload and the like. It actually has _one_ external method, but all the rest is done in DTML only. Maybe this helps, because I think you have a structural problem in your product. greetings, Heiko Marco Mariani wrote:
def NewArticolo(self,REQUEST,RESPONSE): r='' gruppo = REQUEST.form.get('gruppo')
if gruppo: next_art = self['prossimo_articolo'] # property of folder 'foto' upload=self.upload.this() id = 'art_%s'%next_art
newob = upload.Control_Panel.Products.MArticolo.ArtClass(id) newob.id = id # newob.propertysheets.art_info.manage_changeProperties(REQUEST) upload._setObject(id,newob)
r=r+ 'Articolo %s aggiunto.<BR>' % next_art next_art = next_art + 1 next_foto = self['prossima_foto']
for i in gruppo: # upload.manage_clone(upload[i],'foto_%s'%next_foto) # ^^^^^^^ this works
newob.manage_clone(upload[i],'foto_%s'%next_foto) ^^^^^^^ this doesn't
newob["foto_%s"%next_foto].manage_changeProperties({'filename': i}) r=r+ 'Foto %s aggiunta.<BR>' % i next_foto = next_foto + 1
self.manage_changeProperties({'prossimo_articolo': next_art}) self.manage_changeProperties({'prossima_foto': next_foto}) return r
-- heiko.stoermer@innominate.de innominate AG networkingpeople fon: +49.30.308806-0 fax: -77 web: http://innominate.de
On Tue, May 16, 2000 at 06:36:19PM +0200, Heiko Stoermer wrote:
still I don't see why you would use an external method for the functions below.
Because I need the imaging library, and I happen to like python.
When I started zoping, I did far too much in external methods because I didn't know that DTML does it too.
I also didn't find a decent edit-through-ftp solution for DTML (no I ain't gonna learn emacs, no way), though the zopeshell script brings me halfway there.
Maybe this helps, because I think you have a structural problem in your product.
I was an undocumented feature, that could be mentioned on the ZQR.
participants (2)
-
Marco Mariani -
news-list.zopeļ¼ innominate.de