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()
On Wed, Nov 30, 2011 at 4:07 PM, Carlos Hanson <[email protected]>wrote:
> 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 the wizard created a
> 0.py. I've created a db_accounts.py, so it comes after db.py. Since I need
> to subclass Auth, I think I need to either create a file that sorts before
> db.py or add code to db.py. My thought is to minimize the number of changes
> to db.py. I know I will need to change the line which instantiates Auth to
> use MyAuth.
>
> Does anyone have suggestions on how to organize models and customizations
> to Auth?
>
> Thanks.
>
> Carlos
>
--
Bruno Rocha
[http://rochacbruno.com.br]