Web app scope question

F

fee

I'm using mod_python to write a web app. I always load
one file, index.py which generates the skeleton of the page,
while functions and objects from other modules are used to
produce the content based on the current state of the app.

Some of the data, such as a registrants id number, shopping
cart data, current app page/state etc... are needed by almost
every module that provides content for the page. In my old
PHP app, these were simply global vars, which aside from its
reputation as bad form worked fairly well.

Now, I find myself stuffing all of these things into an object,
and passing it around every where, as an argument to each
function, or as a constructor argument. The other alternative
that I have considered is to make a 'borg' class, whose
attributes always remain the same across instantiations.

I just wondered about the experience of the list regarding
sets of data that really need to be visible to most of the
modules in the app.

Thanks,

Toby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top