Hi Guido:

On Wed, 17 Oct 2007, Guido Pelzer wrote:

> all outputs of cdsinvenio to the browser are implement with
> req.write, i think so.  i can't use this output sequence because of
> my css with different boxes. so i want to collect req.write-outputs
> with a dictionary and output the code at a central point.  do you
> think it's a correct way or do you have another idea? which central
> point would you choose?

I'm not sure what exactly you are looking for, but req.write() is only
used to push already prepared HTML output via mod_python/Apache onto
user's browser.  I think you would be better off customizing the
output prior to req.write() is called.

For example, every web page request such as '/foo' usually has
associated a "business logic" function called perform_request_foo()
that simply returns tuple '(body, errors, warnings)', where body
contains the HTML body to be outputted to the user, that is passed
onto the page() function that does the actual output[1].  The style of
the HTML output of the foo page is subsequently generated not inside
perform_request_foo() business logic layer, but rather in
foo_templates.py templating layer, that you can override via template
skin mechanism as explained in the WebStyle Admin Guide:

  <http://cdsware.cern.ch:8000/admin/webstyle/guide.html>

So, in order to customize your output, you can simply tweak functions
such as page() or page_start(), where default CSS and headers are
defined; and, for more deep customizations, you can define your own
template functions by inheriting from default ones as explained in the
above guide.

Please tell me if I misunderstood your question.

Footnotes:
[1] The exception to this page() based schema are time-consuming pages
    such as the search engine results page where we do not want to
    prepare all the page body in advance, but rather to emit it to the
    user step by step as soon as parts of the output are ready; hence
    the use of page_start() and req.write() instead of page() in the
    search engine.

Best regards
-- 
Tibor Simko ** CERN Document Server ** <http://cds.cern.ch/>

  • req.write Guido Pelzer
    • Re: req.write Tibor Simko

Reply via email to