[Zope] Help on __before_publishing_traverse__.
Sidnei da Silva
sidnei@x3ng.com.br
Wed, 23 Jan 2002 11:42:51 -0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello everyone.
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)
My doubt is:
This code works OK for the view property. When a user tries to access the
page, and the date range is outside the permitted range, it gets a login
screen. But then is the following problem:
I have a dtml-in that lists the documents inside this folder, and i want it
not to list the document which is outside the range. But i want to do this
based on the permission. For what i know, the permission to access the
properties of the document is "Access content information". But the strange
thing is that the __before_publishing_traverse__ code is run, the permissions
are set ok but the document keeps listing, except when i click the security
tab. Then, suddenly the document isnt listed anymore.
I think that im missing some operation that the security tab performs to make
the permissions begin to work. Can anybody help me? Anyone know of a method
that gets accessed when i access a property, so i can hook my code on the
right place??
Excuse me for writing a book, but i wanted to keep it clear.
[]'s
- --
Sidnei da Silva
X3ng Web Technology
sidnei@x3ng.com.br
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE8Tr3kjMbPQxgR5X0RApA+AJ9NEBZXOPoT1brQXmuFdS+1dMCEfQCgvoIr
WLNtkFrFQ4M1drzMEvXdNFo=
=YA8b
-----END PGP SIGNATURE-----