[mod_python] empty docstrings

Graham Dumpleton graham.dumpleton at gmail.com
Tue May 15 20:59:02 EDT 2007


On 16/05/07, Martin Dobias <wonder.sk at gmail.com> wrote:
> Yay! Turning it off has made it!
>
> In docs, there's written that PythonOptimize set to On equals -O
> option. But in Python man page it says that docstrings are discarded
> only when two -O options are given... Is it possible to use
> optimalization with mod_python while leaving docstrings in place?

Documentation is wrong. I recollect noting that at some point when
doing mod_wsgi.

So this is all perhaps made more flexible in future, have logged the issue:

  http://issues.apache.org/jira/browse/MODPYTHON-227

A workaround you can use for now is to arrange for the environment variable:

  PYTHONOPTIMIZE=1

to be set and exported in the environment of the user that Apache is
initially started.

Graham

> Thanks a lot for your help.
> Martin
>
> On 5/16/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote:
> > Do you have the directive:
> >
> >   PythonOptimize On
> >
> > set in your Apache configuration. If you do, then comment it out,
> > restart Apache and try again.
> >
> > Graham
> >
> > On 16/05/07, Martin Dobias <wonder.sk at gmail.com> wrote:
> > > Hi,
> > >
> > > I've been trying to get to run matplotlib with mod_python, but it
> > > fails when it gets imported. After some debugging I've found out that
> > > the problem is that parsing of docstrings in their classes fails. The
> > > reason is that the docstrings are empty instead of containing the
> > > actual text.
> > >
> > > Here's a simple script that demonstrates this behaviour - displays
> > > 'None' from MyClass.__doc__
> > >
> > > ======
> > > from mod_python import apache
> > >
> > > class MyClass:
> > >         """some documentation"""
> > >         pass
> > >
> > > def handler(req):
> > >         req.write("Docstring content: %s \n" % MyClass.__doc__)
> > >         return apache.OK
> > > ======
> > >
> > > Is there any way how to enforce inclusion of docstrings?
> > > Or am I missing something essential?
> > >
> > > Regards,
> > > Martin Dobias
> > > _______________________________________________
> > > 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