Re: [web2py] best practice: subclassing Auth

2011-11-30 Thread pbreit
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.

Re: [web2py] best practice: subclassing Auth

2011-11-30 Thread Carlos Hanson
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.

Re: [web2py] best practice: subclassing Auth

2011-11-30 Thread pbreit
Also, what do you need to do exactly? There are some customizations available that don't require sub-classing.

Re: [web2py] best practice: subclassing Auth

2011-11-30 Thread Carlos Hanson
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.

Re: [web2py] best practice: subclassing Auth

2011-11-30 Thread Bruno Rocha
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(

[web2py] best practice: subclassing Auth

2011-11-30 Thread Carlos Hanson
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