[Zope-CMF] Adapting ExternalFile for use in CMF

Kevin Carlson khcarlso@bellsouth.net
Mon, 15 Apr 2002 22:23:33 -0400


I am attempting to adapt the External File product so that it can be used in
CMF.  I am running into an error in what looks to be the area of a guarded
function of some sort.  Here's what I've done so far:

I created a new portal type call CMFExternalFile and set the following:

 MetaType = "External File"
 Product Name = "ExternalFile"
 Factory Method... = "addCMFExternalFile"
 Initial View Name = "manage_addForm"

I also added a python script in the folder /Control_Panel/ExternalFile named
"addCMFExternalFile" with the following lines of code:

   context.manage_addProduct['ExternalFile'].createInObjectManager(id,
context.REQUEST)
   return id

When I try to add a product of type CMFExternalFile from within the CMF I
get the following exception:

   Error Type: AttributeError
   Error Value: createInObjectManager

and the following stack trace:

Traceback (innermost last):
  File C:\PROGRA~1\ZopeTest\lib\python\ZPublisher\Publish.py, line 150, in
publish_module
  File C:\PROGRA~1\ZopeTest\lib\python\ZPublisher\Publish.py, line 114, in
publish
  File C:\PROGRA~1\ZopeTest\lib\python\Zope\__init__.py, line 158, in
zpublisher_exception_hook
    (Object: A)
  File C:\PROGRA~1\ZopeTest\lib\python\ZPublisher\Publish.py, line 98, in
publish
  File C:\PROGRA~1\ZopeTest\lib\python\ZPublisher\mapply.py, line 88, in
mapply
    (Object: invokeFactory)
  File C:\PROGRA~1\ZopeTest\lib\python\ZPublisher\Publish.py, line 39, in
call_object
    (Object: invokeFactory)
  File C:\PROGRA~1\ZopeTest\lib\python\Products\CMFCore\PortalFolder.py,
line 335, in invokeFactory
    (Object: A)
  File C:\PROGRA~1\ZopeTest\lib\python\Products\CMFCore\TypesTool.py, line
701, in constructContent
    (Object: portal_types)
  File C:\PROGRA~1\ZopeTest\lib\python\Products\CMFCore\TypesTool.py, line
429, in constructInstance
    (Object: CMFExternal)
  File C:\PROGRA~1\ZopeTest\lib\python\Shared\DC\Scripts\Bindings.py, line
252, in __call__
    (Object: addCMFExternalFile)
  File C:\PROGRA~1\ZopeTest\lib\python\Shared\DC\Scripts\Bindings.py, line
283, in _bindAndExec
    (Object: addCMFExternalFile)
  File
C:\PROGRA~1\ZopeTest\lib\python\Products\PythonScripts\PythonScript.py, line
291, in _exec
    (Object: addCMFExternalFile)
    (Info: ({'script': <PythonScript instance at 022CB0F8>, 'context':
<__FactoryDispatcher__ instance at 01427270>, 'container':
<__FactoryDispatcher__ instance at 01427270>, 'traverse_subpath': []},
('blah',), {}, None))
  File Script (Python), line 1, in addCMFExternalFile
  File C:\PROGRA~1\ZopeTest\lib\python\AccessControl\ZopeGuards.py, line 47,
in guarded_getattr
AttributeError: (see above)



It appears that the 'createInObjectManager' method doesn't exist -- Any
ideas on where I'm going wrong or on how to accomplish this a different way?

Thanks,

Kevin