Luke Plant wrote:

> > context['choices'] = CHOICES.items()
>
> Just remembered - this doesn't guarantee ordering, you'll need to handle
> sorting of the choices list somehow.

the obvious way being

CHOICES = (
    (1, 'Choice 1'),
    (2, 'Choice 2'),
)

context['choices'] = CHOICES

try:
   choice = dict(CHOICES)[request.GET['userchoice']]
except KeyError:
   # handle invalid input

(dict(seq) is a relatively fast operation)

</F>

Reply via email to