I'm having the same issue. Where do I have to include all this? Is
there some other workaround for this? It would be great if we could
use Sphinx for documenting out Web2Py apps.

Thanks for any help.



On May 28, 5:18 pm, Massimo Di Pierro <[email protected]>
wrote:
> controllers and models in web2py are written in python but are not
> python modules. They use objects
> (request,response,...,local_import,...) that are not imported.
>
> Sphinx does not understand this.
>
> I am sure there is a way around (for example add to your models and
> controllers:
>
> if 1:
>     from gluon import *
>     request,response,session,cache,T = \
>        current.request,current.response,
>        current.session,current.cache,current.T
>     from gluon.compileapp import local_import_aux as local_import
>
> ) but I cannot say for sure without details about what you are trying
> to do.
>
> On May 28, 3:47 am, Vasil Petkov <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hello!
>
> > I use web2py 1.94 on Ubuntu with Python 2.7 and Sphinx 1.0.7. For the
> > documentation purposes, i have created a 'doc'-directory inside my
> > web2py-application. My web2py project has the following structure:
>
> > web2py
> >    |_ server
> >    |      |_ applications
> >    |            |_ init
> >    |            |     |_ controllers
> >    |            |           |_ myapp.py
> >   ...         ...
> >    |            |_ modules
> >    |                  |_ xml2obj.py
> >   ...
> >    |_ doc
>
> > When i try to generate documentation for the myapp.py-file with
> > sphinx, i get the following warning:
>
> >  Traceback (most recent call
> > last):
> >   File "/usr/local/lib/python2.7/dist-packages/Sphinx-1.0.7-py2.7.egg/
> > sphinx/ext/autodoc.py", line 329, in import_object
> >     __import__(self.modname)
> >   File "/home/vpetkov/Documents/web2py/server/applications/init/
> > controllers/myapp.py", line 16, in <module>
> >     xml2obj = local_import('xml2obj', reload=False)
> > NameError: name 'local_import' is not defined
>
> > /home/vpetkov/Documents/web2py/server/doc/myapp.rst:7: (WARNING/2)
> > autodoc can't import/find module 'myapp', it reported error: "name
> > 'local_import' is not defined", please check your spelling and
> > sys.path
>
> > Additionally. in conf.py Sphinx file, i added
> > sys.path.append(os.path.abspath('../applications/init/modules/'))

Reply via email to