+1

I also want to know how to accomplish this outside the request/response
life cycle.

We have a few daemons that use ours util/libs/models and we had the same
problem with i18n.





On Fri, Jan 20, 2017 at 8:55 AM, damien accorsi <
[email protected]> wrote:

> Hi Alessandro, hi all,
>
> I come to you about an issue I'm facing on tracim development.
> Tracim is based on turbogears for all web stuff, it also includes wsgidav
> running through cherrypy in some daemon threads.
>
> The problem I'm facing is that I need to access tg context from requests
> managed by wsgidav (so the code is executed in threads managed by cherrypy,
> running on a daemon thread)
>
> I get the same error as explained on the documentation about gearbox
> command line operations : http://turbogears.readthedocs.
> io/en/latest/turbogears/gearbox.html?highlight=
> context#running-scripts-from-command-line
>
> TypeError: No object (name: context) has been registered for this thread
>
>
> I get exactly the same error. I can make my code to work if I setup
> test-like context :
>
> app = TestApp(...)
> app.get('/_test_vars')
>
> Unfortunnately, this does not solve my problem on a viable manner because
> it means a TestApp is setup on every webdav request.
> A way to fix this would be to override CherrypyWebServer and Cherrypy
> ThreadPool to setup the TestApp on each thread of the CherryPy ThreadPool.
>
> What a dirty way to implement this...
>
> Especially when you know that the only requirement I have is to translate
> lazy strings...
>
> Is there a way (elegant or not) to override gettext/ugettext used in TG
> stuff ? (currently translations are done through tg.translator.ugettext()
> which encapsulate a local ugettext function)
>
> We tried to monkey-patch this part of code unsuccessfully; and because the
> code is something like "meta-programmation code" it's difficult to
> understand how it works (and how it can or cannot be override)
>
>
> Note : if some refactoring is required on turbogears to make
> config/context usable outside tg application, we will help (but we dont
> know where to start our work)
>
> Thanks a lot.
>
>
> Damien
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Ítalo Rossi

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to