> Why do I need to do the following: > > if ('price' in request.POST) and (request.POST['price'] <> > NOT_PICKED): > > instead of > > if request.POST['price'] <> NOT_PICKED:
In the event that for some reason that field hasn't been sent along. This could be some other site using you as a web service, this could be your own mistake...in general it's just good programming practice to not explode if something goes unexpected. These could be rewritten as if request.POST.get('price', NOT_PICKED) <> NOT_PICKED: if you want to shorten it some. -tim --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---