Sphinx cross reference question

Laszlo Nagy gandalf at shopzeus.com
Sun Aug 22 20:07:48 CEST 2010


In my shopzeus.db.pivot.convert.py file, in the run() method of my 
Data2Facts class, I can write this into the docstring:


class Data2Facts(threading.Thread):
     # code here...
     def prepare(self,*args):
         # code here...
     # more code here
     def run(self):
         """
         Start data conversion.

         You need to call :meth:`prepare`  before starting the 
conversion with :meth:`run`.
         """
         # more code here...

This works perfectly - it places cross links in the HTML documentation.

I have another file where I'm writting a tutorial for my Data2Facts 
class. It is not the API, but I would like to make references to the API.

So I can do this:


The :meth:`shopzeus.db.pivot.convert.Data2Facts.prepare` method is used 
for blablabla....

However, I do not want to write "shopzeus.db.pivot.convert." every time. 
I want to make this my current module for cross-referencing. So I tried 
this:

.. :currentmodule:: shopzeus.db.pivot.convert

The :meth:`Data2Facts.prepare` method is used for blablabla....

But it does not work! It is displayed in bold, but there is no link. The 
sphinx build command does not give me any warnings about invalid 
references. What am I doing wrong?

Thanks,

    Laszlo





More information about the Python-list mailing list