[Zope] Set _allowed_meta_types on folder instances without creating a new product?

Dieter Maurer dieter@handshake.de
Fri, 26 Apr 2002 22:25:33 +0200


Jeff Kowalczyk writes:
 > Is there a way to set the class attribute sometimes used in products
 > 
 > class myProduct(...):
 >     _allowed_meta_types = ('Image','File')
 > 
 > On a regular folder instance, without creating a plethora of specialized
 > folder classes?
Yes.

  Make an External Method.
  Call it on the folder and give it as parameter the meta types
  your want to allow.

  The External Method will look like:

      def changeAllowedMetaTypes(self,mts):
	'''set '_allowed_meta_types' to *mts*.'''
        self._allowed_meta_types= tuple(mts)
	return '_allowed_meta_types changed'

  You call it like

      URL_TO_YOUR_FOLDER/changeAllowedMetaTypes?mts:list=Image&mts:list=File



Dieter