[Zope] Help on __before_publishing_traverse__.

Dieter Maurer dieter@handshake.de
Fri, 25 Jan 2002 22:26:41 +0100


Sidnei da Silva writes:
 > Im developing a product in python that does some content management 
 > functions, and one of the features I`m trying to implement is to make the 
 > content public based on some properties, so, i`ve add the following code to 
 > my product:
 > 
 >     def __before_publishing_traverse__(self, REQUEST=None, *args, **kw):
 >       if hasattr(self, 'data_inicial') and hasattr(self, 'data_final'):
 >         if (DateTime.DateTime(self.data_inicial).ISO() < 		
 > DateTime.DateTime().ISO()) \
 >         and (DateTime.DateTime(self.data_final).ISO() > 
 > DateTime.DateTime().ISO()) \
 >         and self.getStatus()=='publicado':
 >           self.manage_permission(permission_to_manage='View', roles=[], 
 > acquire=1, REQUEST=None)
 >           self.manage_permission(permission_to_manage='Access contents 
 > information', roles=[], acquire=1, REQUEST=None)
 >         else:
 >           self.manage_permission(permission_to_manage='View', 
 > roles=['Manager'], acquire=0, REQUEST=None)
 >           self.manage_permission(permission_to_manage='Access contents 
 > information', roles=['Manager'], acquire=0, REQUEST=None)
I do not think, you should use this code.

   At least to me, it seems to modify the object for every request.
   That might give you quite an interesting growth of the ZODB.


Dieter