OK, I think that probably requires subclassing. I subclassed once for
customizing the navbar but ended up just creating my own navbar independent
of auth. I don't recall it being too bad.
Good question. I want to override retrieve_username(). Of course, I expect
I'll eventually want to override any of the methods exposed by Auth. If
there is another way, I would prefer it.While subclassing is easy, it may
be overkill.
Also, what do you need to do exactly? There are some customizations
available that don't require sub-classing.
Thanks. Modules is actually where I started to put it last night, but
decided I should ask the question, since I really want to learn web2py well.
Dont do it in models, do in /modules
in modules/myauth.py
from gluon.tools import Auth
form gluon import *
class MyAuth(Auth):
def __init__(self):
#do whatever you want here
Auth.__init__(self)
in any place of app (model, controller)
from myauth import MyAuth
auth = MyAuth(
Chapter 8 says, "All of the methods above can be extended or replaced by
subclassing Auth." However, it does not give the best place to add the code
to do so. There is mention of adding to your model, but I'm a little
unclear about that too.
It seems that the models are imported in order, since
6 matches
Mail list logo