Re: [Zope3-Users] DropdownWidget with SimpleVocabulary causes ConversionError.

2006-03-28 Thread Michael Howitz
Am Montag, den 27.03.2006, 18:31 +0900 schrieb [EMAIL PROTECTED]:
> I'd like to ask one more question.
> 
> Why does SimpleVocabulary.fromValues/fromItems() not set 'title' ?
> Is there any good reason?
> Current implementation is unconvenient for non-ascii people.

Sure. Maybe a new method is needed which gets tuples of length three
which sets value, token and title.
Otherwise you can write a subclass of SimpleVocabulary which is more
convenient for non-ascii people. (Maybe there is a reason why it is
called 'simple' ;-)

mac



___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] DropdownWidget with SimpleVocabulary causes ConversionError.

2006-03-27 Thread wata
I'd like to ask one more question.

Why does SimpleVocabulary.fromValues/fromItems() not set 'title' ?
Is there any good reason?
Current implementation is unconvenient for non-ascii people.

Regards,
Katsutoshi
--
Watanabe, Katsutoshi

# I beg you to point out the error or rudeness of my english.
# Thank you.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] DropdownWidget with SimpleVocabulary causes ConversionError.

2006-03-27 Thread wata
Hi, Michael.

Your explanations make things very clear.
It was my misuse of SimleVocabulary/SimpleTerm.

I misunderstood the responsibility of token. I didn't notice
that DroopdownWidget renders token only when no title is given.

When reading the docstrings of ITerm/ITokenizedTerm/ITitledTokenizedTerm,
I couldn't realize such things that you explained.  It would
be nice that there were a document like your explanation.

Thanks a lot.

Regards,
Katsutoshi
--
Watanabe, Katsutoshi

# I beg you to point out the error or rudeness of my english.
# Thank you.

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] DropdownWidget with SimpleVocabulary causes ConversionError.

2006-03-26 Thread Michael Howitz
Am Montag, den 27.03.2006, 11:52 +0900 schrieb [EMAIL PROTECTED]: 
> Hi, 
> 
> I got a ploblem with SimpleVocabulary/SimpleTerm.
> Here is the situation of that.
> 
> (1) I used Zope3.2 on Windows XP.
> (2) I made :
>a vocabulary, and
>a Choice field with the vocabulary, and
>a schema contains the field, and
>an add-form using the schema.
> (3) the vocabulary was made using SimpleVocabulary.fromValues().
> with values which are all unicode strings(japanese).

Hi,

Vocabularies hav three levels:
value: which is stored in ZODB
token: which is used as value attribute of the option tag in HTML-Page.
It must be convertable to str with ASCII encoding because when the
conversion is done the encoding of the page is not yet known. (Correct
me if I'm wrong here)
title: which is dislpayed to the user as the contents of the option tag

SimpleVocabulary.fromValues uses the values as value, token and title,
so it is only useable with ASCII values.

So you have to do it like this way:
SimpleVocabulary(SimpleTerm(, , ), ...)

token might be the uid of value, if it is an object which is stored in
ZODB.

-- 
mac

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users