That will not work.

Take this for example.

self.settings.download_url = self.url('download')

So what is actually in self.settings.download_url ??? It's not a
function, its a string that was already generated.

If you follow the function definition at self.url() you notice it
returns self.environment.URL(...), this is a string.

So you can't do

auth.settings.controller = 'myadmin'

Because the URLS have already been generated and strings created from them.


possible solutions include

* only generate the URL when it is actually needed for display,
meaning self.url returns a function not a string.
* pass a "controller" variable along the instantiation of Auth().

-Thadeus





On Tue, Jan 19, 2010 at 7:15 AM, mdipierro <[email protected]> wrote:
> You can do:
>
> self.settings.controller='default'
>
> and the default URLs should change accordingly since they depend on
> self.settings.controller
>
> On Jan 19, 4:47 am, Ivan P <[email protected]> wrote:
>> This is fairly minor problem, but seems to go against the web2py
>> philosophy as I see it. If after initializing the Auth object you
>> would like to change the default controller, you must redefine a bunch
>> of variables:
>> self.settings.login_url,
>> self.settings.logged_url,
>> self.settings.download_url,
>> etc.
>> That is because they are define at the initialization, and altering
>> self.settings.controller afterwards does not solve the problem. It
>> seems to me most people would outright redefine a few of those
>> variables, for example login_next by default points to yourapp/default/
>> index, and few would ever use that as the default. How about something
>> like:
>> class Auth(object):
>>     def __init__(self, environment, db=None, controller='default'):
>>         self.settings.controller=controller
>>
>> Or maybe I'm confused? :)
>
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
>
>
>
>
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to