I've been banging my head around a simple (yet probably not common) use
case where I wanted to fork a process and run a CherryPy instance from
that child process.
I quickly realized that the child process shared (as far as I could tell)
the same cherrypy.engine has its parent, which isn't what I wanted of
I think this is a result of having cherrypy.engine being set to the module
level WSPBus instance in cherrypy.process. This is also the result of
cherrypy various attributes to be set at the module level in
I was therefore wondering if it wouldn't make some sense to lazily bind
cherrypy.engine and other attributes when accessed for the first time.
_engine = None
if not bus:
bus = WSPBus()
# more initializations
if not _engine:
_engine = setup_engine()
_engine = engine
engine = property(_get_engine, _set_engine)
Now, this snippet is entirely not tested and might break in various ways
but it's to illustrate the idea.
That would also mean we can import other CherryPy sub-packages without the
engine being initialized no matter what.
I often use the cherrypy.process without even setting up a CherryPy
application, hence not even starting cherrypy.engine.
This also means, one could "reset" the engine instance.
You received this message because you are subscribed to the Google Groups "cherrypy-devel" group.
To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/cherrypy-devel -~----------~----~----~----~------~----~------~--~---