> According to document, source code and test, currently IS_IN_SET
> accepts a list OR A SET as its first parameter "theset", and an ...

Yep, only lists.

> # Currently I have to use it in this style. It is too verbose to
> mention DO_YOU_LIKE_SUSHI three times.
> SQLField('do_you_like_sushi','text',requires=IS_IN_SET
> (DO_YOU_LIKE_SUSHI, DO_YOU_LIKE_SUSHI.values()))

You can use:

...=IS_IN_SET(  ['yes', 'no','unknown'],
  labels=['Like it? I love it!','Come on, Sushi sucks!','What is
Sushi?'] )

or in a reusable fashion:

sushi_opts= ['yes', 'no','unknown']
sushi_labels=['Like it? I love it!','Come on, Sushi sucks!','What is
Sushi?']
...
...=IS_IN_SET( sushi_opts, sushi_labels )

> SQLField('do_you_like_sushi','text',requires=IS_IN_SET(
>   {'yes': 'Like it? I love it!',
>   'no': 'Come on, Sushi sucks!',
>   'unknown': 'What is Sushi?' }
>   ))

But this looks nice and it seems that even though theset can be either
a dict or a list the attribute ('theset') is not used for  operations
anywhere else in gluon.
The proposal, however,  does not address the support for sets, you CAN
NOT use sets with IS_IN_SET.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to