[mod_python] "0" added after content, magically

Graham Dumpleton grahamd at dscpl.com.au
Fri Aug 4 18:46:57 EDT 2006


When you use mod_python.publisher, the return value is regarded as
content. When you are using your own custom handler, the return value
is the status.

In effect, mod_python.publisher is a custom handler on top of mod_python
which works differently. That it has 'mod_python' in the package name is
confusing to many, because it should be seen as being distinct to basic
mod_python handlers and how they work.

Graham

On 05/08/2006, at 7:39 AM, Alex Greif wrote:

> you are right, if I write:
> return "some html code"
> then the "0" does not appear.
>
> But I am a confused, in the mod_python manual there are many  
> samples like:
> from mod_python import apache
>  def handler(req):
>    req.content_type = 'text/plain'
>    req.write("Hello World!")
>    return apache.OK
>
>
> When do I return apache.OK and when do I return a string?
> What is needed in which situation?
>
> Alex.
>
> On 8/4/06, Robert Brewer <fumanchu at amor.org> wrote:
>>
>>
>>
>> Alex Greif wrote:
>>  > the strange phenomenon is that something appends a "0"
>>  > after my html output. This happens on Unix and also on
>>  > Windows. Any Ideas ?
>>
>>  One idea: apache.OK == 0. Perhaps you're supposed to return data  
>> instead of
>> writing data and then returning a status?
>>
>>
>>  Robert Brewer
>>  System Architect
>>  Amor Ministries
>>  fumanchu at amor.org
>>
>>
> _______________________________________________
> Mod_python mailing list
> Mod_python at modpython.org
> http://mailman.modpython.org/mailman/listinfo/mod_python



More information about the Mod_python mailing list