> Also, when you set sa_auth.cookie_secret in the ini file, it shows up
> as config['sa_auth.cookie_secret'] and needs to be pushed into
> config['sa_auth'] somehow. Anybody know the recommended way of doing
> this? Surely there must be some kind of helper somewhere...
There should be some crazy hubajoo to turn dotted key names into
nested dictionary members inside the config object itself.
If that's not working, and I'm betting it's not, it's because the
logic of that method is:
"""Our custom attribute getter.
Tries to get the attribute off the wrapped object first,
if that does not work, tries dictionary lookup, and finally
tries to grab all keys that start with the attribute and
return sub-dictionaries that can be looked up.
"""
Since there is a sa_auth already defined in the app_cfg, the crazy
magic that makes attribute lookups work for dotted names, isn't going
to kick in.
This whole config system is a bit convoluted, and perhaps could use a
revamp in the next (post 2.1) version of TG. But for now, there are
a couple of obvious options:
1) Move the stuff that's defined in app_cfg out into the ini file, and
the above logic will work
2) Monkeypatch things like you've done above.
I think Michael is working on a patch to move the default to the
right place (the .cfg file) right now.
--Mark Ramm
> I wrote this workaround for 2.0.3 (I was too fed up at this point to
> patch it properly):
>
> class MyAppConfig(AppConfig):
> def setup_sa_auth_backend(self):
> super(MyAppConfig, self).setup_sa_auth_backend()
> if 'sa_auth.cookie_secret' in config:
> config['sa_auth']['cookie_secret'] =
> config['sa_auth.cookie_secret']
> self.sa_auth = config['sa_auth']
>
>
> I think the quickstart project should *default* to storing the
> cookie_secret in the ini file. If you consider the distribution of an
> open source app, clearly the secret should be unique to each
> deployment and changing it shouldn't require modification of the app
> itself. This way it's value can be generated automatically when you
> run 'paster make-config', as is already the case with the beaker
> secret. Are there any disadvantages I'm not seeing?
>
> Cheers, Nathan
>
>
> On 2009 Dec 15, at 4:57 AM, Sanjiv Singh wrote:
>
>> Hi Mike,
>>
>> This one is due to http://trac.turbogears.org/ticket/2414
>>
>> The code was backported from 2.0.3 to avoid two different
>> quickstarted apps
>> trusting each other's cookies unless it is specifically changed.
>>
>> But I agree that we need a better solution for it and I believe Mark
>> had something in mind. Mark?
>>
>> Sanjiv
>>
>> On Tue, Dec 15, 2009 at 10:53 AM, Michael Pedersen
>> <[email protected]> wrote:
>>> I'm now officially confused.
>>> I had a quick start environment working using tg2.1a1 (at least,
>>> and I think
>>> it was working with 2.1a2). I could get paster serve to show pages.
>>> All was
>>> happy in my world.
>>> I've updated to 2.1a3, and I'm now getting told to set up
>>> sa_auth.cookie_secret in my app_cfg or in my development.ini file.
>>> I attempt to add a different cookie_secret to my development.ini
>>> file in
>>> sections DEFAULT, server:main, and app:main.
>>> None of those locations work. How do I put the cookie secret into
>>> my .ini
>>> file (thereby making it easily changed on a per installation basis
>>> without
>>> altering the app_cfg code)?
>>>
>>> --
>>> Michael J. Pedersen
>>> My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/
>>> pedermj022171
>>> Yahoo/pedermj2002, MSN/[email protected]
>>>
>>> --
>>>
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "TurboGears Trunk" 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/turbogears-trunk?hl=en.
>>>
>>
>> --
>>
>> You received this message because you are subscribed to the Google
>> Groups "TurboGears Trunk" group.
>> To post to this group, send email to turbogears-
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/turbogears-trunk?hl=en
>> .
>>
>>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "TurboGears Trunk" 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/turbogears-trunk?hl=en.
>
>
>
--
Mark Ramm-Christensen
email: mark at compoundthinking dot com
blog: www.compoundthinking.com/blog
--
You received this message because you are subscribed to the Google Groups
"TurboGears Trunk" 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/turbogears-trunk?hl=en.