Francois-Regis CHALAOUX writes:
 > Errot Type: NameError
 > Error Value: folder1
 > How to manage this problem ?
 > FR.
 > =====
 > =====
 > 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'
Are you sure, you get the "NameError" inside your external method?

I hope, you are not, because the method cannot raise a (NameError,folder1).

Anyway, if your problem is in Python code, the traceback contains
precise line number information for the problem.

In order to test, whether an object O can access another object o,
you can use: "hasattr(O,'o')".

In your example:

        if hasattr(self,'folder1'): return 'Object exists'

This will not test, that 'folder1' is contained in "self"
but that a 'folder1' is accessible (acquired) in "self".

In order to test for direct containment, you would use
"self.aq_base" instead of "self".


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to