Python – appengine: how to use validator in Class:Property

google-app-enginepythonvalidation

described in http://code.google.com/intl/en/appengine/docs/python/datastore/propertyclass.html#Property

but there is no example code.

i code sth like:

class Model(db.Model):
  email = db.EmailProperty(validator=clean_email)

  def clean_email(self,value):
    if ...

Best Solution

class Model(db.Model):

  def clean_email(value):
    if ...

  email = db.EmailProperty(validator=clean_email)

use a argument. and the argument itself is the value of email in this case.