Hello,

I'm using hashids <http://hashids.org/python/>. I'm generating my own 
forms, without SQLFORM. My tables have a Field.Virtual('hashid', lambda 
row: current.hashids.encrypt(row.table.id)).

I'd like to be able to use SQLFORM, so that a field's IS_IN_DB validator 
would help generate a form where the id is obfuscated using hashids, then 
automatically decode it before inserting in the database.

I've seen that validators.IS_IN_DB excludes FieldVirtual when building "the 
set". I suppose the first step would be to subclass IS_IN_DB and make it 
read the FieldVirtual. Or, I could just ignore that and encode the id using 
hashids, when it's outputted by the options widget. But then I'd have to 
decode it before it's inserted into the database.. but where ?

I'm kind of confused about how to approach this. I'd also like to avoid 
subclassing web2py functionality if possible, but that's a bonus. Any help 
would be appreciated.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to