8 messages in com.googlegroups.pylons-discussRe: is there a good way to stash a gl...| From | Sent On | Attachments |
|---|---|---|
| Jonathan Vanasco | 29 Apr 2008 07:16 | |
| Contact 42 | 29 Apr 2008 07:36 | |
| Wichert Akkerman | 29 Apr 2008 07:38 | |
| Contact 42 | 29 Apr 2008 07:42 | |
| Jonathan Vanasco | 29 Apr 2008 08:02 | |
| Alberto Valverde | 29 Apr 2008 09:46 | |
| Ian Bicking | 29 Apr 2008 09:49 | |
| Jonathan Vanasco | 29 Apr 2008 10:12 |
| Subject: | Re: is there a good way to stash a global var, that doesn't use g/app_globals![]() |
|---|---|
| From: | Ian Bicking (ia...@colorstudy.com) |
| Date: | 04/29/2008 09:49:59 AM |
| List: | com.googlegroups.pylons-discuss |
Jonathan Vanasco wrote:
because i won't know the name of appconfig.py
i'm creating a subclassable framework for distribution
DerivedApp/ DerivedApp/model
BaseApp/ BaseApp/lib/helpers
I'm trying to get the BaseApp/lib/helpers to access Globals, so that it can access objects in DerivedApp/model (which might have overrides)
You'll need to use a function to get the variable from g. The only way to import things like that is if you use another proxy (the pylons.g and pylons.request objects are proxies), and that's really not worth it.
Or, you might be able to do something with subclassing, e.g., have your model subclass by DerivedApp.
In the case of helpers, of course, it's pretty easy: just have lib.helpers in DerivedApp do from baseapp.lib.helpers import *. No need to get too fancy there. That is, you might generally find things to be easier if you simply phrase BaseApp as a library and not anything more fancy. You could make the library itself mostly a class, and have the class instantiated by DerivedApp with whatever customizations it needs.
-- Ian Bicking : ia...@colorstudy.com : 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 pylo...@googlegroups.com
To unsubscribe from this group, send email to
pylo...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---




