> In the java servlet container world, you have the ServletContext hash > that provides a place to put "application scope" objects.
> Is there such a thing in CherryPy? Is it the "Application" object?
> Handler classes (including the root) are instantiated per Request, > correct?
If you are using the default dispatcher then not, why would they? You pass an instance to mount(), not class, so it would not even be possible to instantiate them per-request.
On Wed, Jun 24, 2009 at 10:28 AM, Paweł Stradomski<pstradom...@gmail.com> wrote:
> W liście qwcode z dnia środa 24 czerwca 2009:
>> In the java servlet container world, you have the ServletContext hash
>> that provides a place to put "application scope" objects.
>> Is there such a thing in CherryPy? Is it the "Application" object?
>> Handler classes (including the root) are instantiated per Request,
>> correct?
> If you are using the default dispatcher then not, why would they? You pass an
> instance to mount(), not class, so it would not even be possible to
> instantiate them per-request.
1) ok, so the Application object is an equivalent of the
ServletContext in Java. According to the docs, all cherrypy apps are
wsgi apps, so does that mean all wsgi apps have an "application
scope"? For example, I've struggled to find a ServletContext parallel
in django, and no replies on their user list. Two examples of wanting
to have an application scoped object:
a) a compiled xslt template object (that's threadsafe) that will
be used repeatedly
b) a pylucene SearchIndexer object (that's threadsafe) that will
be used repeatedly
2) ok, handler *objects* are what are mounted (not classes), so that
answers my 2nd question.. so you have to be sure any members used in
support of the methods in your handler classes are thread-safe