Skip to content
This repository has been archived by the owner on Aug 2, 2019. It is now read-only.

Commit

Permalink
Make use of colander.Range for lon/lat (ref #30)
Browse files Browse the repository at this point in the history
  • Loading branch information
leplatrem committed Dec 6, 2012
1 parent c2c56be commit 211ff13
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions daybed/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,11 @@ def __init__(self, *args, **kwargs):

def deserialize(self, cstruct=null):
deserialized = super(PointNode, self).deserialize(cstruct)
if self.gps and not -180.0 <= deserialized[0] <= 180.0:
raise Invalid(self, "Invalid longitude", cstruct)
if self.gps and not -90.0 <= deserialized[1] <= 90.0:
raise Invalid(self, "Invalid latitude", cstruct)
longitude = Range(min=-180.0, max=180.0)
latitude = Range(min=-90.0, max=90.0)
if self.gps:
longitude(self, deserialized[0])

This comment has been minimized.

Copy link
@almet

almet Dec 7, 2012

Member

better 👍

latitude(self, deserialized[1])
return deserialized


Expand Down

0 comments on commit 211ff13

Please sign in to comment.