[Zope-CMF] Bug: 'TypeError: cannot convert string to tuple' in metadata_edit

Grégoire Weber gregoire.weber@switzerland.org
Fri, 13 Jul 2001 17:50:45 +0200


Something for the tracker? Where to track if so?

When I call metadata_edit directly from the browser with a 
parameter which is internaly represented by a tuple like 
'contributors' or subject I get a error, if the parameter
occurs once only:
   http://path/to/obj/metadata_edit?contributors=x

No error on more than one occurance:
   http://path/to/obj/metadata_edit?contributors=x&contributors=y

Type: TypeError
Value: cannot convert string to tuple 

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: DynamicType)
  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: metadata_edit)
  File D:\prog\zope\lib\python\ZPublisher\Publish.py, line 112, in call_object
    (Object: metadata_edit)
  File D:\prog\zope\lib\python\Shared\DC\Scripts\Bindings.py, line 324, in
__call__
    (Object: metadata_edit)
  File D:\prog\zope\lib\python\Shared\DC\Scripts\Bindings.py, line 354, in
_bindAndExec
    (Object: metadata_edit)
  File D:\prog\zope\lib\python\Products\PythonScripts\PythonScript.py, line
336, in _exec
    (Object: metadata_edit)
    (Info: ({'script': <PythonScript instance at 023D6A30>, 'context':
<Document instance at 0237DEA0>, 'container': <CMFSite instance at
023A3830>, 'traverse_subpath': []}, (None, None, None, 'x', None, None,
None, None, None), {}, (None, None, None, None, None, None, None, None,
None)))
  File Script (Python), line 27, in metadata_edit
  File <string>, line 8, in tuplify
  File D:\prog\zope\lib\python\Products\PythonScripts\Guarded.py, line 195,
in __careful_tuple__
TypeError: (see above)


The problem is metadat_edit.py which resides in the content skin 
directory. The following patch corrects the issue:


cvs -q diff -r HEAD metadata_edit.py (in directory
F:\user\greg\tmp\CMF\CMFDefault\skins\content\)
Index: metadata_edit.py
===================================================================
RCS file: /cvs-repository/CMF/CMFDefault/skins/content/metadata_edit.py,v
retrieving revision 1.1
diff -r1.1 metadata_edit.py
8c8,11
<         value = tuple( value )
---
>         if same_type ( value, '-'):
>             value = ( value, )
>         else:
>             value = tuple( value )

*****CVS exited normally with code 1*****

Greg
_____________________________________
Grégoire Weber
mailto:gregoire.weber@switzerland.org