[Zope] FTP and container type products

Petr Knapek knapek@knapek.pvt.net
14 Aug 2000 10:49:45 +0200


Hi Zopists,
I have created new container product 'ISNG Folder' by modification of
classical Folder object. Only some attributes are added to every instance
of ISNG Folder and in future a more functionality. 
But when I try to put any object over ftp, an error occurs. I can't
create any object inside the ISNG Folder object over ftp. I have no such
problem when putting the object into ISNG Folder over web interface. Can
anybody tell me more about ftp access and help me with my problem?

Below the part of my source is listed.

Thanks, Petr


# -------------------------------------------------------------------------
# Here starts code for 'ISNG Folder' object


manage_addISNGFolderForm=HTMLFile('addFolder', globals())

def manage_addISNGFolder(self, cz_id, title='', key_words=[],
                     createPublic=0,
                     createUserF=0,
                     REQUEST=None):
    """Add a new 'ISNG Folder' object with id *id*.

    If the 'createPublic' and 'createUserF' parameters are set to any true
    value, an 'index_html' and a 'UserFolder' objects are created respectively
    in the new folder.
    """
    author = repr(REQUEST.AUTHENTICATED_USER)
    id = cz_id2id(cz_id)
    ob=ISNGFolder()
    ob.id = id
    ob.cz_id = cz_id
    ob.title = title
    ob.creation = DateTime.DateTime(time.time())
    ob.author = author
    ob.modifier = author
    ob.key_words = key_words
    self._setObject(id, ob)
    try: user=REQUEST['AUTHENTICATED_USER']
    except: user=None
    if createUserF:
        if (user is not None) and not (
            user.has_permission('Add User Folders', self)):
            raise 'Unauthorized', (
                  'You are not authorized to add User Folders.'
                  )
        ob.manage_addUserFolder()
    if createPublic:
        if (user is not None) and not (
            user.has_permission('Add Documents, Images, and Files', self)):
            raise 'Unauthorized', (
                  'You are not authorized to add DTML Documents.'
                  )
        ob.manage_addDTMLDocument(id='index_html', title='')
    if REQUEST is not None:
        return self.manage_main(self, REQUEST, update_menu=1)




class ISNGFolder(OFS.Folder.Folder):
    """ISNGFolder class.

    Is created by inheritance from Folder Zope object."""


    meta_type = 'ISNG Folder'
    
    manage_options = OFS.Folder.Folder.manage_options + ({'label':'Edit', 'action':'manage_editForm'},)
    
    __ac_permissions__ = OFS.Folder.Folder.__ac_permissions__
    
    manage_editForm = HTMLFile('editFolder',globals())
    
   # manage_main = HTMLFile('editFolder',globals())

    def manage_edit(self, title, key_words, REQUEST=None):
        """Edits title and key_words atributes of 'ISNG Folder"""
        self.title = title
        self.key_words = key_words
        if REQUEST is not None:
            return MessageDialog(
                title = 'Edited',
                message = 'Properties for %s changed' % self.cz_id,
                action = './manage_main',
                )
-- 
Petr Knápek
NEXTRA Czech Republic, s.r.o., Veveří 102, 659 10 Brno, Czech Republic
e-mail: mailto:petr.knapek@nextra.cz
tel:+420-5-41 558 394
FAX:+420-5-41 558 390