> Hi, all - someone suggested to me that I should try the zope-dev list
> instead of the zope list, here goes.
> When I create ZClasses I can make the Available Objects shrink to just
> a couple of available objects via subclasses and so forth.  How would
> I do this with a Python Class in a Python Zope Product?  (Let's say an
> OFS.Folder.Folder class, which could normally contain all available
> objects.)


In the ObjectManager class (lib/python/OFS/ObjectManager.py), 
there is a method 'filtered_meta_types', which is called by 
the DTML that implements the Zope management screens. The 
job of this method is to filter the list of available objects 
based on the authorization of the user.

An approach that you could use is to override that method in 
your class so that it only returns the object types that you 
want. You should probably retain the filtering based on 
authorization for consistency (you could probably just call 
the ObjectManager class' method and refilter the result in 
your overridden version). For ex:

class MyFolderishObject(ObjectManager):

  def filtered_meta_types(self, user=None):
    # overridden version

    # get the filtered list from superclass, so things 
    # that the user isn't authorized for are already
    # filtered out...
    types=ObjectManager.filtered_meta_types(self, user)

    # each meta type is a mapping - the name of the 
    # object type is under the key 'name'. We'll filter
    # out all that start with 'D' as an example.
    for item in types:
      if item['name'][0] != 'D':

    return result

Hope this helps!

Brian Lloyd        [EMAIL PROTECTED]
Software Engineer  540.371.6909
Digital Creations  www.digicool.com

Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to