|
Guest
Zope Exits
page served by app2
|
|
|
- Contact(s)
Itamar S.T. (itamar@maxnm.NOSPAMcomx)
This proposal is still in a state of flux - add your comments at RestrictedCreationDiscussion.
- Problem
certain types of objects should not be added except in certain places or with certain restrictions. For example, we may want to make sure Book objects are only added inside Library objects, and nowhere else. Or we may want to make sure that an object is added only if there's a MailHost in it's acquistion path. How do we ensure this?
- Proposed Solution
I propose a Restricted Creation Interface - when an ObjectManagerx constructs it's Add list, it first checks with each class if it's instances can be added in this specific ObjectManagerx.
We do this by calling a class method called _addableIn() , that receives as a parameter the ObjectManagerx to which we may want to add objects. If the result is not true, instances of this class can't be added, and won't be listed in the Add list.
For example, the following code will only allow this class to be added inside objects whose meta_type is "Librarian":
class Banana:
""" Ook Ook Ook """
def _addableIn(parent):
if parent.meta_type == "Librarian": return 1
else: return 0
- Risk Factors
We're calling other people's code every time we view the management interface. This can slow things down, and might be a security risk, especially in ZClassesx that are developed throught the web (Python Products are insecure by definition.)
- Scope
Err, donno.
- Deliverables
-
A patch to ObjectManagerx (to the filtered_meta_types function or some such) which adds a check for objects that can be added.
API Documentation.
A mixin class for ZClassesx that's lets them restrict their containers to certain meta_types - equivalent to ObjectManagerx ZClassesx ability to restrict their containees by meta_type.
|
|
|