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

Grégoire Weber gregoire.weber@switzerland.org
Sat, 14 Jul 2001 20:42:17 +0200


forgot to copy this to the list:

Hi Tres,

Thanks for your enlightening answers! 

(Hu! Working Saturdays and so early in the morning?)

It's seems to me that there is a bug. Read on!

> The issue is not whether subject is of those types (it is neither),
> but how you want to have ZPublisher marshall the 'subject' form
> variable:
> 
> [...]
Ok, I now understand it correctly!

> > I had some problems a few days ago when I customized 
> > metadata_edit_form by puting the <select ...> block before the 
> > <textarea ...> block! Perhaps its the same source of problems.
> 
> Hmm, I don't know there;  I would suspect that ZPublisher needs
> to know that the value is to be marshalled as a list when it
> first encounters it;  in that case, you might need to use
> ':lines:list' (untested).

I tested it. For your information:

Doing the following

   <textarea name="subject:lines:list" rows="3" cols="20">...</textarea>
                           ^^^^^ ^^^^
   <select name="subject:list" multiple>...</select>

results in a list (as expected) and the textareas subjects living in
a own list living in the top list (not expected!), result example: 

   [['textarea-para1', 'textarea-para2'], 'select-para3'])

If I choose to code the <select> part before the <textarea> part 
due to optical reasons I get a similar result:

   <select name="subject:list" multiple>...</select>
   <textarea name="subject:lines" rows="3" cols="20">...</textarea>
                           ^^^^^
Results in something like that:

   ['select-para3', ['textarea-para1', 'textarea-para2']])

In the original order you get one list without sublist:

   <textarea name="subject:lines" rows="3" cols="20">...</textarea>
                           ^^^^^
   <select name="subject:list" multiple>...</select>

Hmmmm? It seems to depend in which order you code your form and
(what's really bad!) how the browser groups the parameters.

So, does ZPublisher do his job correctly?

Should he not append the 'subject:lines' parameters to the 
list instead of inserting them as a list into the top list?

To check this yourself: have a look at the original 
metadata_edit_form in CMF 1.1.

Greg

_____________________________________
Grégoire Weber
Rigistr. 31
CH-8006 Zürich
Switzerland
phone:  +41-(0)1-361 66 11
mobile: +41-(0)79-44 11 457
mailto:gregoire.weber@switzerland.org