Skip to content

Instantly share code, notes, and snippets.

@theorm
Created November 26, 2012 01:44
Show Gist options
  • Save theorm/4146165 to your computer and use it in GitHub Desktop.
Save theorm/4146165 to your computer and use it in GitHub Desktop.
class Location(Document):
structure = {
"ll" : validate_coordinates,
"street" : ...
...
}
class Venue(Document):
structure = {
"location" : Location.validate,
"name" : unicode,
...
}
@property
def location(self):
# should be cached
return Location(self['location'])
@benneic
Copy link

benneic commented Nov 26, 2012

In fact that isn't even really necessary... it's just a list so we could override the validate() method on the Venue and implement the check there...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment