thanks for the replies guys, I eventually settled for a custom
validator. I tried to put it in the controller but somehow I can't
check if the form was submitted, and calling
form.accepts(request.vars, session) already inserts the value
MAX_ENTRIES = 3
class CAN_ADD(object):
def __init__(self, error_message='Cannot add more PINEAPPLES,
maximum (%d) reached' % MAX_ENTRIES):
self.e = error_message
def __call__(self, value):
if db(db.TABLE.owner==auth.user.id).count()>=MAX_ENTRIES:
return (value, self.e)
return (value, None)