[Zope-PTK] PTK won't let me add objects
Tres Seaver
tseaver@digicool.com
Tue, 21 Nov 2000 16:28:46 -0500
Tres Seaver wrote:
>
> Paul Winkler wrote:
> >
> > Hi,
> >
> > I just sent this message to the main zope list - sorry, didn't realize
> > there was a separate PTK list.
> >
> > I'm working on a site based on the PTK DemoPortal. PTK is a great
> > product, so I was happy to see a new release announced recently and
> > took the opportunity (yesterday, 11/20) to update my PTK installation
> > from
> > CVS. Well, now the Zope management interface won't let me add anything
> > inside the Portal except Document, Link, News Item, Portal File,
> > Portal Folder, and Portal Image. I'm NOT talking about the Portal
> > interface - just the plain old Zope "Available Objects" button.
> >
> > Is this caused by anything I did? I don't think so - if I add a new
> > Portal it has the same behavior.
>
> Nope, this is a bug. I have been wrestling with the PortalFolder for
> weeks now, and I introduced it while clearing up another problem.
>
> >
> > Was this done on purpose? If so, why on earth would you want to
> > prevent anyone from adding so much as a humble DTML method?? We're not
> > talking about the end-user interface here.
> >
> > For now I'm going to revert to an old version of PTK, bugfixes be
> > damned. I can't get any work done in this version.
> >
> > Suggestions would be most welcome!!
>
> Please submit the issue to the PTK Tracker:
>
> http://www.zope.org/Products/PTK/Tracker
>
> I will work on this issue immediately.
And here is a patch:
Index: PortalFolder.py
===================================================================
RCS file: /cvs-repository/ZopePTK/PTKBase/PortalFolder.py,v
retrieving revision 1.26
diff -u -r1.26 PortalFolder.py
--- PortalFolder.py 2000/11/21 19:01:03 1.26
+++ PortalFolder.py 2000/11/21 21:31:22
@@ -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):
Tres.
--
===============================================================
Tres Seaver tseaver@digicool.com
Digital Creations "Zope Dealers" http://www.zope.org