publisher wrongly generating warning that there is 'nothing to publish'
-----------------------------------------------------------------------

                 Key: MODPYTHON-180
                 URL: http://issues.apache.org/jira/browse/MODPYTHON-180
             Project: mod_python
          Issue Type: Bug
          Components: publisher
    Affects Versions: 3.3
            Reporter: Graham Dumpleton


Publisher handler contains the code:

    # we log a message if nothing was published, it helps with debugging
    if (not published) and (req.bytes_sent==0) and (req.next is None):
        log=int(req.get_config().get("PythonDebug", 0))
        if log:
            req.log_error("mod_python.publisher: nothing to publish.")

The idea is that if the publisher didn't generate any output and simply 
returned None, that a warning would be generated which might be noticed by a 
developer and thus be helpful to debugging problems.

Problem is that "req.bytes_sent" is only actually non zero when data is flushed 
and actually written back to the client by Apache. It does not take into 
consideration any buffered data.

In other words, if "req.write()" is used but second optional argument is always 
being set to 0 indicating that data should not be flushed, then publisher will 
wrongly say nothing actually got published.

Because the PSP classes are no longer flushing data so that output filters like 
"CONTENT_LENGTH" will work, this will mean you will get this warning all the 
time when using code like:

  from mod_python import apache, psp

  def index(req):
      page = psp.PSP(req, 'echo.psp')
      page.run()

Question is, is there a way to determine from Apache that there is buffered 
data. We don't really want to be adding another special flag in the mod_python 
request wrapper like req._content_type_set do we???


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to