Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
application scoped objects
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
qwcode  
View profile  
 More options Jun 24, 12:48 am
From: qwcode <qwc...@gmail.com>
Date: Tue, 23 Jun 2009 21:48:53 -0700 (PDT)
Local: Wed, Jun 24 2009 12:48 am
Subject: application scoped objects
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?


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paweł Stradomski  
View profile  
 More options Jun 24, 12:28 pm
From: Paweł Stradomski <pstradom...@gmail.com>
Date: Wed, 24 Jun 2009 18:28:13 +0200
Local: Wed, Jun 24 2009 12:28 pm
Subject: Re: [cherrypy-users] application scoped objects
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.

--
Paweł Stradomski


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Lakin Wecker  
View profile  
 More options Jun 24, 12:33 pm
From: Lakin Wecker <lakin.wec...@gmail.com>
Date: Wed, 24 Jun 2009 10:33:04 -0600
Local: Wed, Jun 24 2009 12:33 pm
Subject: Re: [cherrypy-users] Re: application scoped objects
Pawel,

You're right, it doesn't instantiate them per request.

However, it might be possible via the __class__ attribute:

>>> class Foo(object):

...     pass
...
>>> x = Foo()
>>> y = x.__class__()
>>> y

<__main__.Foo object at 0x9df7b0c>
>>> x

<__main__.Foo object at 0x9df7acc>

qwcode,

What do you plan to store at that level?

Lakin


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paweł Stradomski  
View profile  
 More options Jun 24, 12:59 pm
From: Paweł Stradomski <pstradom...@gmail.com>
Date: Wed, 24 Jun 2009 18:59:53 +0200
Local: Wed, Jun 24 2009 12:59 pm
Subject: Re: [cherrypy-users] Re: application scoped objects
W liście Lakin Wecker z dnia środa 24 czerwca 2009:

> Pawel,

> You're right, it doesn't instantiate them per request.

> However, it might be possible via the __class__ attribute:

Right, haven't thought of that. Though I don't think any sane framework would
do it.
--
Paweł Stradomski

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
fumanchu  
View profile  
 More options Jun 24, 1:56 pm
From: fumanchu <fuman...@aminus.org>
Date: Wed, 24 Jun 2009 10:56:26 -0700 (PDT)
Local: Wed, Jun 24 2009 1:56 pm
Subject: Re: application scoped objects
On Jun 23, 9:48 pm, qwcode <qwc...@gmail.com> wrote:

> 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?

Yes.

Feel free to help me build http://tools.cherrypy.org/wiki/FromJava as
you learn more. :)

Robert Brewer
fuman...@aminus.org


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
qwcode  
View profile  
 More options Jun 24, 4:18 pm
From: qwcode <qwc...@gmail.com>
Date: Wed, 24 Jun 2009 13:18:26 -0700 (PDT)
Local: Wed, Jun 24 2009 4:18 pm
Subject: Re: application scoped objects
Thanks for all the replies, a few followups

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

Thanks


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google