[Grok-dev] where to put the code that can be run automatically when groks are started up?

TonyXu txu at userful.com
Tue Apr 28 12:53:28 EDT 2009


Thank you for sharing your knowledge. 
It's so complicated that I need more time to understand it and I still don't 
know how I can implement my purpose.
I think you might be able to help me.
The scenario is that I have written a scheduler thread, and I want the
program
can read the configuration from ZODB to initialize the scheduler thread, and
start
the thread right after the Grok applications are started up.



PAW wrote:
> 
> 2009/4/23 TonyXu <txu at userful.com>
> 
>>
>> so far, I put the code in a module outside the functions and classes, it
>> can
>> be run when the grok is started up. However, if I call "grok.getSite()"
>> to
>> get the application object, it return "None". I guess it's because at the
>> beginning of grok's stating up, the grok will load all the modules, so my
>> code can be run, but at that time, the grok is not completely ready.
>> so, where is the best place to put the code?
> 
> 
> I had, when arriving a Grok, a similar issue I believe. Solving this issue
> required me to understand the Grokking, Martian and ZCML configuration
> stage. I wrote a large blog post surrounding my findings:
> 
> http://exploring-grok.blogspot.com/2009/01/grok-configuration-phase-and-its.html
> 
> Can you supply a bit of a summary of what you're trying to achieve
> exactly?
> 
> Thanks,
> Paul
> 
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
> 
> 

-- 
View this message in context: http://www.nabble.com/where-to-put-the-code-that-can-be-run-automatically-when-groks-are-started-up--tp23197488p23281405.html
Sent from the Grok mailing list archive at Nabble.com.



More information about the Grok-dev mailing list