← Back to team overview

openerp-doc team mailing list archive

Re: Autodoc of ORM classes

 

Le 29/12/10 20:23, Don Kirkby a écrit :
Is there documentation on how to make the autodoc work for the ORM
classes?

I'm afraid there is not much specific doc about that online yet, apart from the autodoc documentation itself (but see below)


If I touch the methods.rst file, I get this warning:
doc/source/developer/2_5_Objects_Fields_Methods/methods.rst:24:
(WARNING/2) autodoc can't import/find class 'osv.osv.osv', it reported
error: "No module named osv.osv", please check your spelling and
sys.path

Yes, that's because sphinx-build cannot see and thus import the module.


Let me give you the recipe we use on the doc building system:

1. You need a patched version of the server, because we currently have a little issue with the server config code, that can't distinguish whether it's being called from an external program or as openerp-server. This breaks autodoc because the server bails on the command-line parameters of sphinx-build! The attached patch does the trick, until we refactor the server code to make it importable properly as a library.


2. You need to put the server's "bin" directory in the PYTHONPATH when running sphinx-build, so sphinx can import it. This is how I launch the build:

  $ PYTHONPATH=/path/to/server-trunk/bin make html


I'm guessing that this warning is masking whatever was the problem
with the build for the last week.

Very likely indeed.



BTW, feel free to add this recipe in the documentation if you have some time ;-)
=== modified file 'bin/tools/config.py'
--- bin/tools/config.py	2010-12-29 18:58:33 +0000
+++ bin/tools/config.py	2010-12-29 19:25:38 +0000
@@ -499,5 +499,5 @@
 # FIXME:following line should be called explicitly by the server
 # when it starts, to allow doing 'import tools.config' from
 # other python executables without parsing *their* args.
-config.parse_config()
+#config.parse_config()
 


Follow ups