I thought I'd 'got' globals but...

Bruno Desthuilliers onurb at xiludom.gro
Fri Jul 7 07:11:21 EDT 2006


meridian wrote:
> Thanks Bruno. Not only do you give solutions to my problem but also
> throw in great MVC tutorials too.
> You're a gent.

(blush)

> I'm using
> controller -> A CherryPy app
> views -> Cheetah Templating for the html & data
> model -> mostly SQLite DB using pysqlite
> also Config
> 
> It's only a desk-web app for single-user, so no concurrency issues.

Err... I would not be so confident wrt/ this point. What about having
two browser windows opened on different pages of the app ?

> However, taking on board your advice to avoid globals, I've now
> realised that the info that I need to retain between pages can simply
> be session information (for the only user) that can be initialised at
> startup from the config.
> So I'm looking at just storing it all in the cherrypy.session ram vs
> using python globals.

Think this will be better !-)

But still, avoid overusing sessions - ie, don't make session available
to objects just for covenience when you can pass required data as params.

My 2 cents...

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list