[Zope-dev] Making Role.py's __ac_local_roles__ play nicely with computed attributes

Christian Theune ct at gocept.com
Thu Nov 25 08:29:53 EST 2004


we currently have a project where we calculate local roles dynamically.
This involves using a computed attribute as an __ac_local_roles__
replacement. Unfortunately this doesn't mix too well with assigning them
manually, although our computed attribute takes care.

Why is this and what can we do against that?

__ac_local_roles__ is a dict. It's not a PersistentDictionary, but an
ordinary Python dict. Therefore, to obey the rules of persistence, the
Role.py local role machinery reassigns __ac_local_roles__ after every

I'd like to change this, so that Role.py sets _p_changed instead, which
is what it tries to signal. Additionally you need to explicitly assign
__ac_local_roles__ instead of just getting

dict=self.__ac_local_roles__ or {}

so this becomes

if dict is None:
    self.__ac_local_roles = dict = {}

This change works without disrupting the unit tests and I would love to
get it on Zope 2.8. Any objections?

I take silence as a 'no objections'.


gocept gmbh & co. kg - schalaunische str. 6 - 06366 koethen - germany
www.gocept.com - ct at gocept.com - phone +49 3496 30 99 112 -
fax +49 3496 30 99 118 - zope and plone consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20041125/fa50ba9e/attachment.bin

More information about the Zope-Dev mailing list