[Zope] I _still_ need help on ZClasses and manage_clone

Marco Mariani m.mariani@imola.nettuno.it
Tue, 16 May 2000 15:03:26 +0200


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.