[Zope-CMF] CMFCore - utils.py and add_Product vs __init__ (Problem)
Pascal Samuzeau
samuzeau@oreka.com
Fri, 08 Nov 2002 23:12:27 +0100
Hi,
After some problems with manage_addProduct, I have traced what is
happening.
But I don't know how to resolve it, because I don't know well the CMF
Management.
The problem that I am not able to resolve is to write some add_Product
function, which call the class describe below in the same package.
Every time the __init__'s class is called, but never my add_Product
function.
So in the utils.py of CMFCore, I have just added the line :
raise "content-type: %s et meta-type: %s"
%(content_type,content_type.meta_type)
***************************************************************
def manage_addContent( self, id, type, REQUEST=None ):
""" Add the content type specified by name.
"""
# self is a FactoryDispatcher.
contentinit = self.contentinit
obj = None
for content_type in contentinit.content_types:
if content_type.meta_type == type:
+ raise "content-type: %s et meta-type: %s"
%(content_type,content_type.meta_type)
obj = content_type( id )
break
if obj is None:
raise 'NotFound', type
self._setObject( id, obj )
if REQUEST is not None:
return self.manage_main(self, REQUEST)
*******************************************************
With this I have runned some Add Product. One of my result here.
(notice : it's not MY Product)
*******************************************************
Traceback (innermost last):
File D:\Zope2-5\lib\python\ZPublisher\Publish.py, line 150, in
publish_module File D:\Zope2-5\lib\python\ZPublisher\Publish.py, line
114, in publish
File D:\Zope2-5\lib\python\Zope\__init__.py, line 158, in
zpublisher_exception_hook File
D:\Zope2-5\lib\python\ZPublisher\Publish.py, line 98, in publish File
D:\Zope2-5\lib\python\ZPublisher\mapply.py, line 88, in mapply
(Object: manage_addContent) File
D:\Zope2-5\lib\python\ZPublisher\Publish.py, line 39, in call_object
(Object: manage_addContent)
File D:\Zope2-5\lib\python\Products\CMFCore\utils.py, line 476, in
manage_addContent content-type: <extension class
Products.CMFCalendar.Event.Event at 0161FA50> et meta-type: CMF Event:
(see above)
*******************************************************
As far as I am able to understand, I see that my Product is called by
content-type: <extension class Products.CMFCalendar.Event.Event at
0161FA50>
But I was intend thet is was called by:
content-type: <extension class
Products.CMFCalendar.Event.Event.addEvent at 0161FA50>
Two reasons of this "error" :
1 - I have not well written my product. I don't think, for the reason
that I have tested this with other product NOT written by me
2 - It's really an error ( I think so, until...)
Cheers
PS
--------------------------------------------------
Oreka ! Nous sommes l'internet moins cher !
Surfez 25% moins cher avec http://www.oreka.com