maposmatic-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Maposmatic-dev] debugging empty floats in /apis/papersize/


From: David MENTRE
Subject: Re: [Maposmatic-dev] debugging empty floats in /apis/papersize/
Date: Sat, 21 Apr 2012 18:10:37 +0200

2012/4/21 David MENTRE <address@hidden>:
> Is there a proper way to tell Django that the four values should be
> valid float numbers?

In fact, Django assigns None to the variable when the value is not a float.

> My current approach would be to catch the "TypeError" exception and
> return HttpResponseBadRequest("ERROR: Invalid arguments") in that
> case. Does it seem correct to you? Any suggestion to fix this issue in
> a more Django-ic or Pythonic way?

I have added a check against None for the four coordinates, returning
HttpResponseBadRequest in case of error.

Patches sent to the list.

Best regards,
d.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]