python - AppEngine NDB property validations -


i wonder best approach validating ndb entity properties likes:

  • a date must in future
  • a grade (integer property) must between 1 , 10
  • a reference entity must have property values (e.g. book.category.active must true)

i'm using wtforms validate submitted requests, want enforce validations on lower level datastore entities itself.

so i'm looking call validate on datastore entity see if it's valid or not. in case it's valid can put entity datastore, if it's not valid want retrieve invalid properties including applies validator did not validate successfully.

another reason wtforms might not sufficient i'm experiencing new cloud endpoints. in model i'm receiving actial entity , not http request.

how other appengine users solving this?

not is best solution, roll own. pre-define bunch of properties reg-exs/mins , maxs etc. seems properties straight forward enough wouldn't difficult.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -