return (value, None) class HAS_MAX_DECIMAL_PLACES(object): def __init__(self, max_decimal_places, error_message="Value cannot have more than %s decimal places"): self.max_decimal_places = max_decimal_places self.error_message = error_message def __call__(self, value): exponent = decimal.Decimal(10) ** -(self.max_decimal_places) try: value.quantize(exponent, context=decimal.Context(traps=[decimal.Inexact])) except decimal.Inexact: return (value, self.error_message % self.max_decimal_places) return (value, None) auth.table_user().first_name.requires = [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_NAME()] auth.table_user().last_name.requires = [IS_NOT_EMPTY(error_message=auth.messages.is_empty), IS_NAME()] auth.table_user().username.comment = "e.g. johnsmith9, ColinTheCoinCollector, mushroom11" ## configure email mail = auth.settings.mailer mail.settings.server = 'logging' if request.is_local else myconf.take('smtp.server') mail.settings.sender = myconf.take('smtp.sender') mail.settings.login = myconf.take('smtp.login') ## configure auth policy auth.settings.registration_requires_verification = False auth.settings.registration_requires_approval = False auth.settings.reset_password_requires_verification = True #########################################################################