Now in Zope 2.9 I get these warnings::

 2006-01-26 14:31:45 WARNING Init Class
Products.MyProduct.Homesite.FilesContainer has a security declaration
for nonexistent method 'FileManagement'

That's understandable because I've coded it like this::

 class MyProduct(...):
     security.declareProtected('View', 'FileManagement.html')

 setattr(MyProduct, 'FileManagement.html', MyProduct.FileManagement)

In other words, I create methods after the class has been defined and
squeeze them in manually. Very convenient.
To avoid the WARNING message above I thought I could use
declareProtected() _after_ the the class has been defined just as with
the additional method; but no luck :(
I tried this::
 class MyProduct(...):

 setattr(MyProduct, 'FileManagement.html', MyProduct.FileManagement)'View', 'FileManagement.html')

But I'm getting::

 AttributeError: type object 'MyProduct' has no attribute 'security'

Which I totally don't understand. To test my sanity I wrote this test
script which works fine::

 class _Z:
    def __init__(self):
        self.z = "Z"
    def declareProtected(self, *a,**k):
        print "++declare something+"
def foo():
    print "I'm being called"
    return _Z()
class A:
    def __init__(self):
print dir(A)

Which works like you'd expect with the followin output::

 I'm being called
 ++declare something+
 ['__doc__', '__init__', '__module__', 'security']

What's going on [differently] in Zope? What am I missing?

Peter Bengtsson,
Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to