PETER BARKER
newbarker at btinternet.com
Sat Mar 10 03:19:35 EST 2007
Hello all, BACKGROUND ---------- I have a set of PSP pages; index.psp, about.psp, etc. These call into sub-templates to get the page header, footer, etc. They only really difffer in the "content" area and I like this maintainability. These are served by Apache and the mod_python.psp handler (PythonHandler mod_python.psp | .psp). I have a another page called client.psp. This template is used by a "Client Area" of the website which is a Python module; ClientArea.py. This allows the user to login to the site to do more stuff in the Client Area. client.psp looks similar to index.psp, etc. to maintain the consistent appearance of the site, but is given it's content by the ClientArea.py module: def _mergeWithTemplate(req,txt): pathname = os.path.join(os.path.dirname(req.filename),'client.psp') template = psp.PSP(req,filename=pathname) return template.run({'theContent':txt}) The content is very dynamic; it'll be a login form, or a table showing database information, etc. PROBLEM ------- When a user's logged into the site I want to display a "Sign Out/Logoff" link at the top of every page. Not only on client.psp which is templated within the Python module, but index.psp and about.psp too. I had a bright idea - I can use req.session and check it within the psp templates. However, this is only going to be set for client.psp as the other pages get served from Apache directly. Do I really want to add session grabbing logic to the PSP pages and make them more complicated? QUESTION -------- Taking a step back from my actual problem, I'd like some criticism on my approach to this development. What's the best practice/standard/canonical way of employing mod_python to develop a site with a handful of quasi-static pages which look very similar and the content is known in advance (but I might want to add logoff link or similar), and a page which has the same look as the other pages but the content is very fluid? Regards, Pete -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20070310/12626341/attachment.html
|