[Grok-dev] Re: Understanding unicode

Sebastian Ware sebastian at urbantalk.se
Mon Sep 24 07:20:38 EDT 2007


I was using SimpleVocabulary, but only after seing Uli's mail did I  
realise how to use the createTerm() method in order to add 'title' to  
the term. The fromItems() method was better documented in the source,  
so I used that one.

Changing the code to use createTerm() was easy as pie :)

Mvh Sebastian

24 sep 2007 kl. 03.16 skrev Philipp von Weitershausen:

> Sebastian Ware wrote:
>> A recipe for this would be very much appreciated, even if it is a  
>> bit cumbersome :) Choice fields with only ascii representations  
>> are rather limited with repect to usability.
>
> Note that only the values=[] option is problematic here. If you're  
> using a proper vocabulary, you're fine.
>
>> I have had to use ISO-codes instead of country names in a current  
>> project and it is not a very good solution.
>
> Then you're ignoring the obvious solution: a vocabulary (or  
> source). As long as you provide a token that's a pure-ASCII  
> representation of the value, you're fine. You can use whatever you  
> want for the values (even arbitrary objects). All you need is a one- 
> to-one mapping from tokens to objects.
>
> To create the vocabulary you can use SimpleVocabulary.fromItems()  
> which takes a list of (token, value) pairs.
>
>
> -- 
> http://worldcookery.com -- Professional Zope documentation and  
> training



More information about the Grok-dev mailing list