Hi everybody,

I am stuck with the following problem for witch I don't have a
solution. I would appreciate it very much if you could help me with

I have a very simple Python product with only one class that extends
Folder. The name of the product is MyClass and the MyClass.py module
is below:

from OFS.Folder import Folder
from Products.PageTemplates.PageTemplateFile import PageTemplateFile

from constants import *

manage_addMyClass_html = PageTemplateFile('zpt/myclass_manage_add', globals())
def manage_addMyClass(self, id, title='', REQUEST=None):
   """ """
   ob = MyClass(id, title)
   self._setObject(id, ob)
   if REQUEST:
       return self.manage_main(self, REQUEST, update_menu=1)

class MyClass(Folder):
   """ """

   meta_type = METATYPE_MYCLASS

   def __init__(self, id, title):
       self.id = id
       self.title = title

And the constants.py module contains:

import Globals

MYCLASS_PRODUCT_PATH = Globals.package_home(globals())

PERMISSION_ADD_MYCLASS = 'MyClass - Add Components'

In the ROOT folder I create the following python script (listing):

for x in container.objectValues(['My Class']):
 print '[%s] - [%s]' % (x.meta_type, x.absolute_url())
return printed

Then I follow the steps:

1. Create an instance with the id 'instance1' (in the drop down I have
'My Class').
2. I run the 'listing' script and I get:

[My Class] - []

3. I change the constant METATYPE_MYCLASS into 'My New Class'
4. I run the 'listing' script and I get:

[My New Class] - []

5. I create a second instance with the id 'instance2' (in the drop
down I have 'My New Class').
6. I run the 'listing' script and I get:

[My New Class] - []

7. I modify the python script by changing the 'My Class' with 'My New Class'
8. I run the 'listing' script and I get:

[My New Class] - []

In the ZMI for both instances the meta_type 'My New Class' is
displayed. I don't understand why the first instance is not displayed
after I change the meta_type value in the python Product.
Moreover, if I try to explicit update the meta_type property for the
first instance to the new value, the result is the same.

What I am trying to accomplish is to be able to change the meta_type
value and this to work (e.g. with no effect on python scripts like

Thank you very much,
Zope maillist  -  Zope@zope.org
**   No cross posts or HTML encoding!  **
(Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to