KLEIN Stéphane wrote:
Hello,

I try to build CMF Product.

If you start learning this you might also want to take a look at

    http://www.neuroinf.de/LabTools/MySite

Raphael


I read chapiter 13 "Writing a Product in Python" of "The Definitive Guide to Plone" book (http://docs.neuroinf.de/PloneBook/ch12.rst?image_scale=narrow).


I look the install method of Extensions/Install.py file.

I the book, I've this code :

def install(self):
    out = []
    typesTool = getToolByName(self, 'portal_types')
    skinsTool = getToolByName(self, 'portal_skins')

    if id not in typesTool.objectIds():
           typesTool.manage_addTypeInformation(
                  add_meta_type = factory_type_information['meta_type'],
                   id = factory_type_information['id']
               )
           out.append('Registered with the types tool')
    else:
        out.append('Object "%s" already existed in the types tool' % (id))

When I use this code, I've this error :

"""
2005-05-05 19:36:33
failed:
Traceback (most recent call last):

File "/home/harobed/newzope/Products/CMFQuickInstallerTool/QuickInstallerTool.py", line 235, in installProduct
res=install()


File "/home/harobed/myzope/lib/python/Products/ExternalMethod/ExternalMethod.py", line 232, in __call__
return f(self.aq_parent.this(), *args, **kw)


File "/home/harobed/newzope/Products/ZHelloWorld/Extensions/Install.py", line 22, in install
)


File "/home/harobed/newzope/Products/CMFCore/TypesTool.py", line 598, in manage_addTypeInformation
raise ValueError, (


ValueError: Meta type ZHelloWorld is not a type class.
"""

ZHelloWorld is my product name.

Now, in source code tarbal example, I've this :

from Products.CMFCore.TypesTool import FactoryTypeInformation as fti_klass

...

def install(self):
    out = []
    typesTool = getToolByName(self, 'portal_types')
    skinsTool = getToolByName(self, 'portal_skins')

if id not in typesTool.objectIds():
typesTool.manage_addTypeInformation(
fti_klass.meta_type, id = plone_product_name
)
out.append('Registered with the types tool')
else:
out.append('Object "%s" already existed in the types tool' % (id))


Here, the value of fti_klass.meta_type is "Factory-based Type Information".

What is the good method ? Why I must add type class with fti_klass meta_type name and not my meta_type value ?

Thanks for your help,
  -- Stéphane

_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests




_______________________________________________
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests

Reply via email to