Try doing this as a custom paste command.You can simply write a
command for paste; then you call that command like paster command (i
think; its in the documentation on how to use it).

On Apr 6, 7:19 pm, eleith <[email protected]> wrote:
> i've got a cron script that runs daily that uses many of my pylons
> project's models and libs. i'm using the following method to get at
> the models/libs and it works well
>
> ------------------------
> import sys
>
> sys.path.append('/path/to/myapp')
>
> from paste.deploy import appconfig
> from myapp.config.environment import load_environment
>
> conf     = appconfig('config:/path/to/myapp/development.ini')
> load_environment(conf.global_conf, conf.local_conf)
>
> from myapp.model import *
> from myapp.lib import *
> ------------------------
>
> everything works, accept  whenever my model or my libs encounter a
> pylons global variable (g.something). whenever it encounters this i
> get the error output
>
> ----------------------
>   File "/usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/
> registry.py", line 137, in __getattr__
>     return getattr(self._current_obj(), attr)
>   File "/usr/lib/python2.5/site-packages/Paste-1.7.2-py2.5.egg/paste/
> registry.py", line 194, in _current_obj
>     'thread' % self.____name__)
> TypeError: No object (name: app_globals) has been registered for this
> thread
> -------------------------
>
> while i certainly could get access to my global variables through
> config['pylons.app_globals'], my pylons project has already been
> written using g.something throughout.
>
> is my only option to go through and rewrite my project without using
> the g variable, or is there a way for it to be pulled in when i run my
> cron script. (all the global variables are static, i just have many of
> them, so i used the globals object instead of ini, to not have so much
> stuff in my ini file)
>
> any suggestions?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to