[Zope-CMF] CMFDefault DublinCore - utils.py tuplize bug?

Daniele d.tarini@icube.it
Thu, 30 Jan 2003 12:48:13 +0100


Hello,

I'm importing DublinCore for a content of mine and I used the setSubject 
method passing a string as subject. I was expecting to set subject as tuple 
got by splitting the string (on whitespaces); actually what I got for subject 
is a tuple of characters (the characters in the string).

Looking at the code I found setSubject uses "tuplize" in the utils.py module 
and I think this is where the odd behaviour (bug?) comes from. 

utils.py says (line 144):

def tuplize( valueName, value, splitter=lambda x: x.strip() ):

where it should say

def tuplize( valueName, value, splitter=lambda x: x.split() ):

since the tuplize method body says:

---------------------
    if type( value ) == type( () ):
        return seq_strip( value )

    if type( value ) == type( [] ):
        return seq_strip( tuple( value ) )

    if type( value ) == type( '' ):
        return seq_strip( tuple( splitter( value ) ) )   # splitter is here!

    raise ValueError, "%s of unsupported type" % valueName
---------------------


Thanks,
	Daniele =)

-- 
Daniele Tarini - Research & Developement - Icube S.r.l.
Address:        Via Ridolfi 15 - 56124 Pisa (PI), Italy
E-mail: d.tarini@icube.it     Web:    http://www.icube.it
Phone:  (+39) 050 97 02 07      Fax:    (+39) 050 31 36 588