[Zope] some Zope issues: dtml-zpt, permissions, scalability
Michael Bernstein
webmaven at cox.net
Tue Nov 25 16:00:03 EST 2003
Andre Meyer wrote:
>
> Another problem occurs with permissions. The following snippet works in
> dtml, but when converted to zpt (accessing here/listEntriesByGroup) the
> same method cannot be accessed any longer.
Soon after writing the 'Zope Bible', but before it was published, I
discovered that PageTemplateFile instances were restricted code, unlike
DTMLFile instances. The relevant thread starts here:
http://mail.zope.org/pipermail/zpt/2002-February/002856.html
To fix the problems you're having in converting the Addressit product to
ZPTs, you'll simply need to add the appropriate security assertions to
the relevant methods. I believe you'll also need to grant access to some
class attributes (or else expose them via accessor methods). Read the
whole thread referenced above, it should give you all the information
you need.
> Yet another issue is related to scalability when I have an object that
> references a list of other objects using a *dictionary*. How does this
> perform when the dictionary contains 10.000 or 50.000 entries? Is that
> feasible or are there better solutions?
The dictionary based approach is *not* truly scalable, instead you can
replace the dictionary with a BTree, which gives you the same
access-by-key interface as a dict, but doesn't suffer from the same
problems as a dictionary.
Information about using BTrees can be found here:
http://zope.org/Members/ajung/BTrees/DataTypes/FrontPage
The most critical difference in using a BTree is that you cannot simply
use assignment such as
self.Entries[id] = entry
But will instead have to use the Btree's insert method, like this:
self.Entries.insert(id, entry)
I may have forgotten some other minor changes. If so, I apologize.
I hope this information is helpful to you,
- Michael R. Bernstein
michaelbernstein.com
Author of Zope Bible
More information about the Zope
mailing list