I'm having a difficult time coming up with an approach to
configuration settings that "belong" to the Model.  Or perhaps I don't
quite have my head around something else.

Anyway, for example, consider a settings for controlling outbound
email from my application.  During development, I want certain email
sent to my personal account, but in production, I want that email sent
to the actual Help Desk queue.  So I have a couple of entries in my
development.ini file, and then as part of deployment, I create a
production.ini file with slightly different values.  So far, so good.

So what is the best way to get that information to my Model?  I can
have the function that sends the email call
pyramid.thread_local.get_registry every time, but the information in
question never changes, so I'd like not to do that.  I can have the
view function pass the values to the model or pass the whole
request.registry to the model, but that fails the same test (the
values never change).  I can call an initialization function in the
model at the end of my "main" function, but then I'm just asking for a
whole collection of such initialization functions and calls thereto
(for all of the other parts of my model that need such configuration
settings).

Obviously, all of these solutions work, but none of them seems like
the Right Way.  The email settings don't vary once the application
starts, and IMO aren't really the view's business.  I've settled, for
now, on an initialization function in the model that's called from the
end of "main."

Is there a best practice for these things?  Or should I give up on a
clean, complete separation between the view and the model for these
types of settings?  Or is there something else I'm missing?

Thanks,
Dan

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to