[Zope-dev] Re: [Zope-PTK] A subclass from PortalMember of Membership Product and ObjectManager won't list contained objects ObjectManager won't list contained objects

Tres Seaver tseaver@digicool.com
Tue, 02 Jan 2001 22:55:56 -0500


Dirksen wrote:

> My site is installed with the Membership system. I want to
> store some photos in each member. So I create a new member
> ZClass, subclassing PortalMember and ObjectManager, and set the
> 'manage_main' as the main view. Under the instance of this new
> member ZClass, I can add images, but I can't find them!
> 'objectItems' always return None. Yet the image file is there.
> I can edit their properties as in
> '/test/acl_users/jay/photo1/manage_main', but
> '/test/acl_users/jay/manage_main' just won't show a thing!

I'm guessing you have installed the latest tarball of the PTK, and
not the CVS version;  that tarball shipped with a bug in PortalFolder,
which prevented classes which had not registered as "portal content"
from showing up in its objectItems()/objectValues/objectIds() lists.

Please try upgrading to the latest CVS and see if the problem persists 
(http://www.zope.org/Products/PTK/ has directions for getting the CVS
version).  Alternately, here is the patch for PTKBase/PortalFolder.py:

diff -u -r1.25 -r1.27
--- PortalFolder.py	2000/11/08 22:48:38	1.25
+++ PortalFolder.py	2000/11/21 21:36:17	1.27
@@ -110,9 +110,22 @@
                          )
 
     def all_meta_types( self ):
-        return ( self.content_meta_types
-               + PortalFolder.inheritedAttribute( 'meta_types' )
-               )
+
+        names = {}
+        types = []
+
+        for cmt in self.content_meta_types:
+            names[ cmt[ 'name' ] ] = 1
+            types.append( cmt )
+
+        superTypes = PortalFolder.inheritedAttribute( 'all_meta_types'
)( self )
+
+        for smt in superTypes:
+            if not names.has_key( smt[ 'name' ] ):
+                names[ smt[ 'name' ] ] = 1
+                types.append( smt )
+
+        return tuple( types )
     
     def manage_addPortalFolder(self, id, title='',
                                REQUEST=None):
@@ -130,11 +143,13 @@
     listActions__roles__ = ()
     def listActions( self, info ):
 
-        return [ { 'name'           : 'View'
+        return ( { 'name'           : 'View'
                  , 'url'            : info.folder_url
                  , 'permissions'    : []
                  , 'category'       : 'folder'
-                 } ]
+                 }
+               ,
+               )
 
     _morphSpec__roles__ = ()
     def _morphSpec( self, spec ):


Tres.
-- 
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org