EricHolmberg wrote:
> I have some controllers that use configuration values to control their
> behavior. I want to test this behavior, so I would like to set the
> configuration item to a known value and run a test. What's the best
> way to do this (or should I be using the configuration values
> differently)?
>
> Example code (here I have cached the values in the constructor, I
> could also load them for each request, although I would like to avoid
> that if possible).
Well, a couple ways. You can use multiple configuration files (not just
test.ini). You can also pass arguments to loadapp(), like
loadapp('test.ini', db='something'), then use %(db)s in your ini file to
substitute that value in. Last you can instantiate your application
direction from the function in wsgiapp, as the configuration just turns
into a simple function call, of the function in wsgiapp.
--
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---