thanks Richard.

I saw the changelog thanking Niphold wrt docstrings but only found
Massimo's suggestion of additional code to add to each .py file to get
Sphinx to "find" all my project files.

Off the bat, after I point Sphinx at gluon, I get errors about request,
current et al not being found. This is what I expected given web2py's
architecture. I'm just on the hunt for a workaround.

I see that gluon/packages/dal has Sphinx definition files but these, I
don't think, provide clues to how to deal with request et al. And gluon
itself doesn't have Sphinx config files so, perhaps, Sphinx-support has a
way to go?


On Tue, 8 Aug 2017 at 16:51 Richard Vézina <ml.richard.vez...@gmail.com>
wrote:

> 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 <c...@hunterroach.com>
> 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 <petko...@dir.bg> 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 web2py+unsubscr...@googlegroups.com.
>
>
>> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/cYQTCXeGVdU/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Carl D Hunter Roach
Bisham Barn Owl Group
Runnymede Ringing Group

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to