On Friday, May 27, 2016 at 6:47:32 AM UTC-4, David Orme wrote:
>
> Hi Anthony,
>
> Many thanks. Just to check - option 1 would have to be done in the web2py 
> codebase (i.e. outside of the application code)? I don't think there's any 
> simple way of overriding the version of simple_hash imported from 
> gluon.utils that LazyCrypt() calls.
>

Actually, you have to monkey patch simple_hash in gluon.validators, but you 
can do it in your application code (e.g., in a model file):

def my_hash(*args):
    ...
    return hash

import gluon.validators
gluon.validators.simple_hash = my_hash

Of course, once that code has been run, it will affect all applications 
until you restart the server. Also, since it really only needs to be run 
once (not on every request), you could put it in routes.py, which is only 
run when the server starts (or when you explicitly reload it).

Anthony

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to