Property sheet interface and selection properties
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Invalid
|
Medium
|
Unassigned |
Bug Description
1. create ZClass derived from DTMLDocument and ObjectManager
2. add a property sheet instance to the class
3. add some simple string properties
4. add a python script to the methods of this ZClass which returns a simple string array
5. add a selection property based on the script in 4.
6. try to add a property sheet interface to this property sheet instance
This runs into following error:
> Traceback (innermost last):
> Module ZPublisher.Publish, line 101, in publish
> Module ZPublisher.mapply, line 88, in mapply
> Module ZPublisher.Publish, line 39, in call_object
> Module ZClasses.Property, line 84, in manage_createView
> Module ZClasses.Property, line 188, in manage_createEditor
> Module ZClasses.Method, line 103, in manage_
> Module OFS.DTMLMethod, line 403, in addDTMLMethod
> AttributeError: 'unicode' object has no attribute 'read'
7. when removing the selection property all works fine
Try to replace in DTMLMethod.py, addDTMLMethod()
if type(file) is not type(''): file=file.read()
with
if not isinstance(file, (str, unicode)): file=file.read()
No idea where the unicode string in your case comes from. I think that 'file' should either be a file or a string but never a unicode string.
Please report back