[Zope-CMF] A 'Portal Image' added programaticaly behaves different than a
manualy added one
Grégoire Weber
gregoire.weber@switzerland.org
Thu, 02 Aug 2001 18:29:27 +0200
Hi everybody!
If I add a CMF image programaticaly, it does not behave like one
added manualy through the CMF by pressing 'Add...' in folder contents.
If I want to view the image by
http://localhost:8080/up/Members/gugus/org_logo/view
I get the following error
Not Found: Cannot find default view for "/up/Members/gugus/org_logo"
Traceback (innermost last):
File D:\prog\zope\lib\python\ZPublisher\Publish.py, line 223, in
publish_module
File D:\prog\zope\lib\python\ZPublisher\Publish.py, line 187, in publish
File D:\prog\zope\lib\python\Zope\__init__.py, line 221, in
zpublisher_exception_hook
(Object: org_logo)
File D:\prog\zope\lib\python\ZPublisher\Publish.py, line 171, in publish
File D:\prog\zope\lib\python\ZPublisher\mapply.py, line 160, in mapply
(Object: view)
File D:\prog\zope\lib\python\ZPublisher\Publish.py, line 112, in
call_object
(Object: view)
File F:\user\greg\data\zope\Products\CMFCore\PortalContent.py, line
247, in view
(Object: org_logo)
File F:\user\greg\data\zope\Products\CMFCore\PortalContent.py, line
234, in __call__
(Object: org_logo)
File F:\user\greg\data\zope\Products\CMFCore\PortalContent.py, line
227, in _getDefaultView
(Object: org_logo)
Not Found: (see above)
In contrast http://localhost:8080/up/Members/gugus/org_logo correctly
shows the image.
The code::
product_path = os.path.join(Globals.package_home(globals()))
fileobj = open(os.path.join(product_path, 'img', 'earthsmile.gif'), 'rb')
filedata = fileobj.read()
Image.addImage(f,
'org_logo',
title = '%s Home' % member_id,
file = filedata,
format = 'image/gif')
fileobj.close()
Some additional informations
- I'm able to view the metadata edit form, but I can't save the changes
(http://localhost:8080/up/Members/gugus/org_logo/metadata_edit_form).
I get the following error:
AttributeError: 'None' object has no attribute 'getActionById'
- In the ZMI the images icon looks like a DTML Document !!! hm?
I do this in the context of createMemberarea which I hotfixed (works well)
to put a default logo into the members folder after creation of the
member folder.
I'am using CMF 1.1 on Zope 2.3.3 on WinNT4SP6
What's (obviously) wrong?
Hints helping me to find a way to solve the problem myself also appreciated.
Greg
_____________________________________
Grégoire Weber
mailto:gregoire.weber@switzerland.org