Some more examples:

*IS IN SET*
In [29]: IS_IN_SET([1,2,3])("1")
Out[29]: ('1', None)

In [30]: IS_IN_SET([0,2,3])("1")
Out[30]: ('1', <lazyT 'value not allowed'>)

*IS NOT IN DB*
In [60]: IS_NOT_IN_DB(db,'auth_user.id')('3')
Out[60]: ('3', None)

###### NOTE that logic is inverse #####
my_id = 5
if IS_NOT_IN_DB(db,'table.id')(my_id)[1]:
    # if returns true, the value is already in db
    print "sorry cant duplicate the record id"
else:
    #if returns false, means that the value is not in db
    db.table.insert(...)




--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]

Reply via email to