Re: Difference between request.POST.get('foo') and request.POST['foo']?

2010-03-26 Thread Daniel
Thanks guys, that was very clear and helpful. On Mar 24, 2:23 am, Mahmoud Abdelkader wrote: > In python, dictionaries have a get method that will return None if you > call it on a dictionary key that doesn't exist. get() can also take an > optional default parameter that

Re: Difference between request.POST.get('foo') and request.POST['foo']?

2010-03-24 Thread Mahmoud Abdelkader
In python, dictionaries have a get method that will return None if you call it on a dictionary key that doesn't exist. get() can also take an optional default parameter that returns it's value if the key doesn't exist. If you use the indexing method, i.e. [], it invokes the dictionaries

Re: Difference between request.POST.get('foo') and request.POST['foo']?

2010-03-24 Thread Eric Abrahamsen
On Tue, 2010-03-23 at 23:14 -0700, Daniel wrote: > Hi, > > Are these statements equivalent? I want to say no, but I can't see > why. Nope. If the key 'foo' doesn't exist, request.POST.get('foo') will return None, while request.POST['foo'] will blow up with a KeyError. Using the get() method on

Difference between request.POST.get('foo') and request.POST['foo']?

2010-03-24 Thread Daniel
Hi, Are these statements equivalent? I want to say no, but I can't see why. Thank you -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send