Z Object Publishing Environment

Search | Download | Documentation | Resources | Members

Search  

 

 Guest

Join Zope.org
Log in


Developer Home
Get Involved!
The Fishbowl
Resources
Proposals
Projects


 Zope Exits

ZopeZen
Zope Newbies
Appwatch.com


page served by app2

Proposals Table of Contents Last edited on Jan 20, 2001 2:41 pm
zope_fish.jpg
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

  1. A patch to ObjectManagerx (to the filtered_meta_types function or some such) which adds a check for objects that can be added.

  2. API Documentation.

  3. 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.

View source RestrictedCreation
Advanced Actions / History
Visitor: Anonymous User
Jump to:
... by pagename prefix or search term.
For a plain search:
SearchPage
 
 
Privacy policy       Printable Page       Feedback about Zope.org