List Info

Thread: application level data sharing




application level data sharing
user name
2006-11-21 17:07:50
hi,
  what i wantta do is to share some data in memory which is
shared
between each session. or in other words it's scope is
application level
rather than session level.

class Root:
         def __init__(self):
               #where to put this data to share between each
session/request?
               #something like
cherrypy.appContex.put("data",
self.data)
               self.data = "somedata" #may be a
large list or dict

               self.plot = Plot()
               self.plot.expose = True
         ...
class Plot:
        def __init__(self):
        #how to get the data from application context?
              self.data =  ? #something like
cherrypy.appContext.get("data")
         ...

i know, i can init the data and pass around with parameter,
for e.g.
        self.plot = Plot(data)

i am here to seek a more elegance way in cherrypy, as what
we can do
with Java Servlet -- there is a Web Context called
"javax.servlet.ServletContext" scope, and we can
simply store and
retrieve the data in application level. any suggestion?

thanx & rgds
dyno


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )