I think web2py is sphinx compliant now, I recall that Simone (Niphold) had refactor docstring to do so... To be confirmed...
Richard On Tue, Aug 8, 2017 at 11:06 AM, Carl Hunter Roach <[email protected]> wrote: > Is this still the recommended workaround to get Sphinx to generate > documentation for projects built upon Web2py? > > > > On Saturday, 28 May 2011 16:18:42 UTC+1, Massimo Di Pierro 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/')) > > -- > Resources: > - http://web2py.com > - http://web2py.com/book (Documentation) > - http://github.com/web2py/web2py (Source code) > - https://code.google.com/p/web2py/issues/list (Report Issues) > --- > You received this message because you are subscribed to the Google Groups > "web2py-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

