Hi there,

I have a little help class:

class NamesProxy:


    def __init__(self,names):

    def __getitem__(self,item):
        return self.names[item]

    def __len__(self):
        return len(self.names)

...which lets me do batches over .objectValues() of BTreeFolders without ZOpe's security whining.

Any, so that I can do:

<tal:x define="Batch       nocall:modules/ZTUtils/Batch;
               NamesProxy  nocall:modules/Products/MyProduct/NamesProxy;">

...I have the following in MyProduct's __init__.py:

from AccessControl import ModuleSecurityInfo
security = ModuleSecurityInfo()
# make NamesProxy usable from PageTemplates
from namesproxy import NamesProxy

...all well and good, yes?

Okay, now it gets weird :-S

This works fine for a while (as in period of time) and then you start getting errors of the following sort:

File /usr/local/zope/2.6.1/lib/python/Products/PageTemplates/TALES.py, line 217, in evaluate
File /usr/local/zope/2.6.1/lib/python/Products/PageTemplates/Expressions.py, line 206, in __call__
File /usr/local/zope/2.6.1/lib/python/Products/PageTemplates/Expressions.py, line 194, in _eval
File /usr/local/zope/2.6.1/lib/python/Products/PageTemplates/Expressions.py, line 150, in _eval
(Info: modules)
File /usr/local/zope/2.6.1/lib/python/Products/PageTemplates/Expressions.py, line 346, in restrictedTraverse
(Object: Products.ScreenDigest)
(Info: {'path': ['Products', 'MyProduct', 'NamesProxy'], 'TraversalRequestNameStack': []})
Unauthorized: You are not allowed to access NamesProxy in this context

What gives?

Weirder still, this can be fixed by restarting Zope... until the next time it starts doing it :-(

Any ideas?


Simplistix - Content Management, Zope & Python Consulting
           - http://www.simplistix.co.uk

Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )

Reply via email to