Created
November 26, 2012 01:44
-
-
Save theorm/4146165 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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']) |
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
Or maybe use a custom type as the some embedded element for custom validation and the rest is just an dict structure...