Hi,

In the following code I test if a folder exists. The folder name to test is
generated on the fly and here I try to simultate it with 'exce' function (may
my error). The first time object2create does not exist and object2create is
well created but if run again the script I obtain the following error :

Errot Type: NameError
Error Value: folder1

How to manage this problem ?

FR.

=====
CODE
=====
def testFolder(self):
    self=self.this()
    sub1=self.folder1
    exec "object2create = 'folder11'"
    try:
        if sub1.object2create:
            return 'Object exists'
    except AttributeError:
        sub1.manage_addFolder(object2create)
        return 'Object created'

                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                                                                              
                  

_______________________________________________
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 )

Reply via email to