[book] add autoload section from code and fix sphinx warnings stable
authorJulien Jehannet <julien.jehannet@logilab.fr>
Thu, 16 Jun 2011 12:31:27 +0200
branchstable
changeset 7529 2fdc310be7cd
parent 7528 11659cbe5eea
child 7530 15178bf89fb6
[book] add autoload section from code and fix sphinx warnings * drop misleading faq entry since clear explanation can be found in internationalization chapter * use autodata sphinx directive instead of raw text * fill empty chapter with autodoc: - devweb/httpcaching.rst - devweb/resource.rst - devweb/views/idownloadable.rst - devweb/views/wdoc.rst * use shebang in excerpt to denote shell code * fix some bad indented docstrings in javascript files
doc/book/en/admin/config.rst
doc/book/en/admin/index.rst
doc/book/en/annexes/faq.rst
doc/book/en/annexes/rql/debugging.rst
doc/book/en/annexes/rql/intro.rst
doc/book/en/annexes/rql/language.rst
doc/book/en/devrepo/vreg.rst
doc/book/en/devweb/controllers.rst
doc/book/en/devweb/httpcaching.rst
doc/book/en/devweb/index.rst
doc/book/en/devweb/resource.rst
doc/book/en/devweb/views/idownloadable.rst
doc/book/en/devweb/views/index.rst
doc/book/en/devweb/views/wdoc.rst
doc/book/en/tutorials/advanced/part05_ui-advanced.rst
doc/book/en/tutorials/tools/windmill.rst
selectors.py
server/__init__.py
web/data/cubicweb.calendar.js
web/data/cubicweb.timeline-bundle.js
web/views/idownloadable.py
--- a/doc/book/en/admin/config.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/admin/config.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -209,6 +209,8 @@
 Pyro configuration
 ------------------
 
+Pyro name server
+~~~~~~~~~~~~~~~~
 If you want to use Pyro to access your instance remotely, or to have multi-source
 or distributed configuration, it is required to have a Pyro name server running
 on your network. By default it is detected by a broadcast request, but you can
@@ -216,9 +218,13 @@
 
 To do so, you need to :
 
+* be sure to have installed it (see :ref:`InstallDependencies`)
+
 * launch the pyro name server with `pyro-nsd start` before starting cubicweb
 
 * under debian, edit the file :file:`/etc/default/pyro-nsd` so that the name
   server pyro will be launched automatically when the machine fire up
 
+Note that you can use the pyro server without a running pyro nameserver.
+Refer to `pyro-ns-host` server configuration option for details.
 
--- a/doc/book/en/admin/index.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/admin/index.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -14,6 +14,8 @@
    :numbered:
 
    setup
+   setup-windows
+   config
    cubicweb-ctl
    create-instance
    instance-config
--- a/doc/book/en/annexes/faq.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/annexes/faq.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -185,12 +185,6 @@
 recommended also for other attribute types). By default it expects to generate
 HTML, so it deals with rich text formating, xml escaping...
 
-How do I translate an msg id defined (and translated) in another cube ?
------------------------------------------------------------------------
-
-You should put these translations in the `i18n/static-messages.pot`
-file of your own cube.
-
 How to update a database after a schema modification ?
 ------------------------------------------------------
 
--- a/doc/book/en/annexes/rql/debugging.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/annexes/rql/debugging.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -8,26 +8,15 @@
 Available levels
 ~~~~~~~~~~~~~~~~
 
-:DBG_NONE:
-    no debug information (current mode)
-
-:DBG_RQL:
-    rql execution information
-
-:DBG_SQL:
-    executed sql
+Server debugging flags. They may be combined using binary operators.
 
-:DBG_REPO:
-    repository events
-
-:DBG_MS:
-    multi-sources
-
-:DBG_MORE:
-    more verbosity
-
-:DBG_ALL:
-    all level enabled
+.. autodata:: cubicweb.server.DBG_NONE
+.. autodata:: cubicweb.server.DBG_RQL
+.. autodata:: cubicweb.server.DBG_SQL
+.. autodata:: cubicweb.server.DBG_REPO
+.. autodata:: cubicweb.server.DBG_MS
+.. autodata:: cubicweb.server.DBG_MORE
+.. autodata:: cubicweb.server.DBG_ALL
 
 
 Enable verbose output
@@ -40,6 +29,8 @@
     from cubicweb import server
     server.set_debug(server.DBG_RQL|server.DBG_SQL|server.DBG_ALL)
 
+.. autofunction:: cubicweb.server.set_debug
+
 
 Detect largest RQL queries
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -50,7 +41,5 @@
 API
 ~~~
 
-.. autofunction:: cubicweb.server.set_debug
-
 .. autoclass:: cubicweb.server.debugged
 
--- a/doc/book/en/annexes/rql/intro.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/annexes/rql/intro.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -159,3 +159,4 @@
 .. _Datalog: http://en.wikipedia.org/wiki/Datalog
 .. _intensional: http://en.wikipedia.org/wiki/Intensional_definition
 .. _extensional: http://en.wikipedia.org/wiki/Extension_(predicate_logic)
+
--- a/doc/book/en/annexes/rql/language.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/annexes/rql/language.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -152,6 +152,10 @@
 
 - Aggregate Functions: COUNT, MIN, MAX, AVG, SUM, GROUP_CONCAT
 
+.. note::
+   Aggregate functions will return None if there is no result row.
+
+
 Having
 ```````
 
--- a/doc/book/en/devrepo/vreg.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/devrepo/vreg.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -79,7 +79,7 @@
 .. autoclass:: cubicweb.selectors.has_add_permission
 .. autoclass:: cubicweb.selectors.has_mimetype
 .. autoclass:: cubicweb.selectors.is_in_state
-.. autoclass:: cubicweb.selectors.on_fire_transition
+.. autofunction:: cubicweb.selectors.on_fire_transition
 .. autoclass:: cubicweb.selectors.implements
 
 
--- a/doc/book/en/devweb/controllers.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/devweb/controllers.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -16,11 +16,11 @@
 `Browsing`:
 
 * the View controller is associated with most browsing actions within a
-  CubicWeb application: it always instantiates a :ref:`the_main_template` and
-  lets the ResultSet/Views dispatch system build up the whole content; it
-  handles :exc:`ObjectNotFound` and :exc:`NoSelectableObject` errors that may
-  bubble up to its entry point, in an end-user-friendly way (but other
-  programming errors will slip through)
+  CubicWeb application: it always instantiates a
+  :ref:`the_main_template_layout` and lets the ResultSet/Views dispatch system
+  build up the whole content; it handles :exc:`ObjectNotFound` and
+  :exc:`NoSelectableObject` errors that may bubble up to its entry point, in an
+  end-user-friendly way (but other programming errors will slip through)
 
 * the JSon controller (same module) provides services for Ajax calls,
   typically using JSON as a serialization format for input, and
--- a/doc/book/en/devweb/httpcaching.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/devweb/httpcaching.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -1,3 +1,21 @@
 HTTP cache management
----------------------
-XXX feedme
\ No newline at end of file
+=====================
+
+.. automodule:: cubicweb.web.httpcache
+
+Cache policies
+--------------
+.. autoclass:: cubicweb.web.httpcache.NoHTTPCacheManager
+.. autoclass:: cubicweb.web.httpcache.MaxAgeHTTPCacheManager
+.. autoclass:: cubicweb.web.httpcache.EtagHTTPCacheManager
+.. autoclass:: cubicweb.web.httpcache.EntityHTTPCacheManager
+
+Exception
+---------
+.. autoexception:: cubicweb.web.httpcache.NoEtag
+
+Helper functions
+----------------
+.. autofunction:: cubicweb.web.httpcache.set_http_cache_headers
+
+.. NOT YET AVAILABLE IN STABLE autofunction:: cubicweb.web.httpcache.lastmodified
--- a/doc/book/en/devweb/index.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/devweb/index.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -17,5 +17,6 @@
    edition/index
    facets
    internationalization
-..   property
+   property
    httpcaching
+   resource
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/book/en/devweb/resource.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -0,0 +1,16 @@
+Locate resources
+----------------
+
+.. automethod:: cubicweb.web.webconfig.WebConfiguration.locate_resource
+.. automethod:: cubicweb.web.webconfig.WebConfiguration.locate_doc_file
+.. automethod:: cubicweb.web.webconfig.WebConfiguration.locate_all_files
+
+Static files handling
+---------------------
+
+.. automethod:: cubicweb.web.webconfig.WebConfiguration.static_directory
+.. automethod:: cubicweb.web.webconfig.WebConfiguration.static_file_exists
+.. automethod:: cubicweb.web.webconfig.WebConfiguration.static_file_open
+.. automethod:: cubicweb.web.webconfig.WebConfiguration.static_file_add
+.. automethod:: cubicweb.web.webconfig.WebConfiguration.static_file_del
+
--- a/doc/book/en/devweb/views/idownloadable.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/devweb/views/idownloadable.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -1,5 +1,23 @@
-The 'download' view
--------------------
+The 'download' views
+====================
+
+.. automodule:: cubicweb.web.views.idownloadable
+
+Components
+----------
+
+.. autoclass:: cubicweb.web.views.idownloadable.DownloadBox
 
-(:mod:`cubicweb.web.views.idownloadable`)
+Download views
+--------------
 
+.. autoclass:: cubicweb.web.views.idownloadable.DownloadView
+.. autoclass:: cubicweb.web.views.idownloadable.DownloadLinkView
+.. autoclass:: cubicweb.web.views.idownloadable.IDownloadablePrimaryView
+.. autoclass:: cubicweb.web.views.idownloadable.IDownloadableLineView
+
+Embedded views
+--------------
+
+.. autoclass:: cubicweb.web.views.idownloadable.ImageView
+.. autoclass:: cubicweb.web.views.idownloadable.EHTMLView
--- a/doc/book/en/devweb/views/index.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/devweb/views/index.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -25,7 +25,7 @@
 
    urlpublish
    breadcrumbs
-..   wdoc
+   idownloadable
+   wdoc
 ..   embedding
-..   idownloadable
 
--- a/doc/book/en/devweb/views/wdoc.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/devweb/views/wdoc.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -1,9 +1,17 @@
 .. -*- coding: utf-8 -*-
 
 Online documentation system
----------------------------
+===========================
+
+.. automodule:: cubicweb.web.views.wdoc
 
-(:mod:`cubicweb.web.views.wdoc`)
+Help views
+----------
+.. autoclass:: cubicweb.web.views.wdoc.InlineHelpView
+.. autoclass:: cubicweb.web.views.wdoc.ChangeLogView
 
-XXX  describe the on-line documentation system
-
+Actions
+-------
+.. autoclass:: cubicweb.web.views.wdoc.HelpAction
+.. autoclass:: cubicweb.web.views.wdoc.ChangeLogAction
+.. autoclass:: cubicweb.web.views.wdoc.AboutAction
--- a/doc/book/en/tutorials/advanced/part05_ui-advanced.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/tutorials/advanced/part05_ui-advanced.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -3,6 +3,8 @@
 
 We'll now see how to benefit from features introduced in 3.9 and 3.10 releases of CubicWeb
 
+.. _uiprops:
+
 Step 1: tired of the default look?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
--- a/doc/book/en/tutorials/tools/windmill.rst	Fri Jun 17 09:37:49 2011 +0200
+++ b/doc/book/en/tutorials/tools/windmill.rst	Thu Jun 16 12:31:27 2011 +0200
@@ -23,23 +23,21 @@
 environment, take a look to the `virtualenv
 <http://pypi.python.org/pypi/virtualenv>`_ project as well)::
 
-    pip install windmill
-    curl -O http://github.com/windmill/windmill/tarball/master
+    $ pip install windmill
+    $ curl -O http://github.com/windmill/windmill/tarball/master
 
 However, the Windmill project doesn't release frequently. Our recommandation is
-to used the last snapshot of the Git repository:
-
-.. sourcecode:: bash
+to used the last snapshot of the Git repository::
 
-    git clone git://github.com/windmill/windmill.git HEAD
-    cd windmill
-    python setup.py develop
+    $ git clone git://github.com/windmill/windmill.git HEAD
+    $ cd windmill
+    $ python setup.py develop
 
 Install instructions are `available <http://wiki.github.com/windmill/windmill/installing>`_.
 
 Be sure to have the windmill module in your PYTHONPATH afterwards::
 
-    python -c "import windmill"
+    $ python -c "import windmill"
 
 X dummy
 -------
@@ -60,9 +58,9 @@
 
     *From: http://www.x.org/wiki/XorgTesting*
 
-Then, you can run the X server with the following command :
+Then, you can run the X server with the following command ::
 
-    /usr/bin/X11/Xvfb :1 -ac -screen 0 1280x1024x8 -fbdir /tmp
+    $ /usr/bin/X11/Xvfb :1 -ac -screen 0 1280x1024x8 -fbdir /tmp
 
 
 Windmill usage
@@ -82,13 +80,15 @@
 
 If you are using firefox as client, consider the "firebug" option.
 
-If you have a running instance, you can refine the test by the *loadtest* windmill option:
+If you have a running instance, you can refine the test by the *loadtest* windmill option::
 
-    windmill -m firebug loadtest=<test_file.py> <instance url>
+    $ windmill -m firebug loadtest=<test_file.py> <instance url>
 
-Or use the internal windmill shell to explore available commands:
+Or use the internal windmill shell to explore available commands::
 
-    windmill -m firebug shell <instance url>
+    $ windmill -m firebug shell <instance url>
+
+And enter python commands:
 
 .. sourcecode:: python
 
@@ -125,7 +125,7 @@
 
 To run your test series::
 
-    % pytest test/test_windmill.py
+    $ pytest test/test_windmill.py
 
 By default, CubicWeb will use **firefox** as the default browser and will try
 to run test instance server on localhost. In the general case, You've no need
@@ -144,6 +144,8 @@
 
 Examples:
 
+.. sourcecode:: python
+
     browser = 'firefox'
     test_dir = osp.join(__file__, 'windmill')
     edit_test = False
@@ -162,7 +164,7 @@
 
 For instance, CubicWeb framework windmill tests can be manually run by::
 
-    % pytest web/test/test_windmill.py
+    $ pytest web/test/test_windmill.py
 
 Edit your tests
 ---------------
@@ -172,7 +174,7 @@
 But if you are using `pytest` as test runner, use the `-i` option directly.
 The test series will be loaded and you can run assertions step-by-step::
 
-    % pytest -i test/test_windmill.py
+    $ pytest -i test/test_windmill.py
 
 In this case, the `firebug` extension will be loaded automatically for you.
 
--- a/selectors.py	Fri Jun 17 09:37:49 2011 +0200
+++ b/selectors.py	Thu Jun 16 12:31:27 2011 +0200
@@ -1252,15 +1252,18 @@
 
 def on_fire_transition(etype, tr_name, from_state_name=None):
     """Return 1 when entity of the type `etype` is going through transition of
-    the name `tr_name`. If `from_state_name` is specified, this selector will
-    also check the incoming state.
+    the name `tr_name`.
+    
+    If `from_state_name` is specified, this selector will also check the
+    incoming state.
 
     You should use this selector on 'after_add_entity' hook, since it's actually
     looking for addition of `TrInfo` entities. Hence in the hook, `self.entity`
     will reference the matching `TrInfo` entity, allowing to get all the
     transition details (including the entity to which is applied the transition
-    but also its original state, transition, destination state, user...).  See
-    :class:`cubicweb.entities.wfobjs.TrInfo` for more information.
+    but also its original state, transition, destination state, user...).
+    
+    See :class:`cubicweb.entities.wfobjs.TrInfo` for more information.
     """
     def match_etype_and_transition(trinfo):
         # take care trinfo.transition is None when calling change_state
--- a/server/__init__.py	Fri Jun 17 09:37:49 2011 +0200
+++ b/server/__init__.py	Thu Jun 16 12:31:27 2011 +0200
@@ -18,7 +18,7 @@
 """Server subcube of cubicweb : defines objects used only on the server
 (repository) side
 
-This module contains functions to initialize a new repository.
+The server module contains functions to initialize a new repository.
 """
 
 from __future__ import with_statement
@@ -39,14 +39,23 @@
 # server-side debugging #########################################################
 
 # server debugging flags. They may be combined using binary operators.
-DBG_NONE = 0  # no debug information
-DBG_RQL = 1   # rql execution information
-DBG_SQL = 2   # executed sql
-DBG_REPO = 4  # repository events
-DBG_MS = 8    # multi-sources
-DBG_MORE = 16 # more verbosity
-DBG_ALL = 1 + 2 + 4 + 8 + 16
-# current debug mode
+
+#:no debug information
+DBG_NONE = 0  #: no debug information
+#: rql execution information
+DBG_RQL  = 1
+#: executed sql
+DBG_SQL  = 2
+#: repository events
+DBG_REPO = 4
+#: multi-sources
+DBG_MS   = 8
+#: more verbosity
+DBG_MORE = 16
+#: all level enabled
+DBG_ALL  = DBG_RQL + DBG_SQL + DBG_REPO + DBG_MS + DBG_MORE
+
+#: current debug mode
 DEBUG = 0
 
 def set_debug(debugmode):
--- a/web/data/cubicweb.calendar.js	Fri Jun 17 09:37:49 2011 +0200
+++ b/web/data/cubicweb.calendar.js	Thu Jun 16 12:31:27 2011 +0200
@@ -15,9 +15,9 @@
 /**
  * .. class:: Calendar
  *
- * Calendar (graphical) widget
+ *   Calendar (graphical) widget
  *
- * public methods are :
+ *   public methods are :
  *
  *   __init__ :
  *    :attr:`containerId`: the DOM node's ID where the calendar will be displayed
@@ -74,7 +74,7 @@
     /**
      * .. function:: Calendar._uppercaseFirst(s)
      *
-     * utility function (the only use for now is inside the calendar)
+     *    utility function (the only use for now is inside the calendar)
      */
     this._uppercaseFirst = function(s) {
         return s.charAt(0).toUpperCase();
@@ -83,7 +83,7 @@
     /**
      * .. function:: Calendar._domForRows(rows)
      *
-     * accepts the cells data and builds the corresponding TR nodes
+     *    accepts the cells data and builds the corresponding TR nodes
      *
      * * `rows`, a list of list of couples (daynum, cssprops)
      */
@@ -98,7 +98,7 @@
     /**
      * .. function:: Calendar._headdisplay(row)
      *
-     * builds the calendar headers
+     *    builds the calendar headers
      */
     this._headdisplay = function(row) {
         if (_CAL_HEADER) {
@@ -224,13 +224,17 @@
     this.hide); // connect(inputId, 'onfocus', this, 'hide');
 };
 
-// keep track of each calendar created
+/**
+ * .. data:: Calendar.REGISTRY
+ *
+ *     keep track of each calendar created
+ */
 Calendar.REGISTRY = {};
 
 /**
  * .. function:: toggleCalendar(containerId, inputId, year, month)
  *
- * popup / hide calendar associated to `containerId`
+ *    popup / hide calendar associated to `containerId`
  */
 function toggleCalendar(containerId, inputId, year, month) {
     var cal = Calendar.REGISTRY[containerId];
@@ -251,7 +255,7 @@
 /**
  * .. function:: toggleNextMonth(containerId)
  *
- * ask for next month to calendar displayed in `containerId`
+ *    ask for next month to calendar displayed in `containerId`
  */
 function toggleNextMonth(containerId) {
     var cal = Calendar.REGISTRY[containerId];
@@ -261,7 +265,7 @@
 /**
  * .. function:: togglePreviousMonth(containerId)
  *
- * ask for previous month to calendar displayed in `containerId`
+ *    ask for previous month to calendar displayed in `containerId`
  */
 function togglePreviousMonth(containerId) {
     var cal = Calendar.REGISTRY[containerId];
@@ -271,7 +275,7 @@
 /**
  * .. function:: dateSelected(cell, containerId)
  *
- * Callback called when the user clicked on a cell in the popup calendar
+ *    callback called when the user clicked on a cell in the popup calendar
  */
 function dateSelected(cell, containerId) {
     var cal = Calendar.REGISTRY[containerId];
--- a/web/data/cubicweb.timeline-bundle.js	Fri Jun 17 09:37:49 2011 +0200
+++ b/web/data/cubicweb.timeline-bundle.js	Thu Jun 16 12:31:27 2011 +0200
@@ -1,10 +1,15 @@
+/**
+ *  This file contains timeline utilities
+ *  :organization: Logilab
+ */
+
 var SimileAjax_urlPrefix = baseuri() + 'data/';
 var Timeline_urlPrefix = baseuri() + 'data/';
 
 /*
  *  Simile Ajax API
  *
- *  Include this file in your HTML file as follows:
+ *  Include this file in your HTML file as follows::
  *
  *    <script src="http://simile.mit.edu/ajax/api/simile-ajax-api.js" type="text/javascript"></script>
  *
--- a/web/views/idownloadable.py	Fri Jun 17 09:37:49 2011 +0200
+++ b/web/views/idownloadable.py	Thu Jun 16 12:31:27 2011 +0200
@@ -15,8 +15,10 @@
 #
 # You should have received a copy of the GNU Lesser General Public License along
 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
-"""Specific views for entities adapting to IDownloadable"""
-
+"""
+Specific views for entities adapting to IDownloadable
+=====================================================
+"""
 __docformat__ = "restructuredtext en"
 _ = unicode
 
@@ -50,6 +52,7 @@
 
 
 class DownloadBox(component.EntityCtxComponent):
+    """add download box"""
     __regid__ = 'download_box'    # no download box for images
     __select__ = (component.EntityCtxComponent.__select__ &
                   adaptable('IDownloadable') & ~has_mimetype('image/'))
@@ -71,7 +74,9 @@
 
 
 class DownloadView(EntityView):
-    """this view is replacing the deprecated 'download' controller and allow
+    """download view
+    
+    this view is replacing the deprecated 'download' controller and allow
     downloading of entities providing the necessary interface
     """
     __regid__ = 'download'
@@ -199,6 +204,7 @@
 
 
 class ImageView(AbstractEmbeddedView):
+    """image embedded view"""
     __regid__ = 'image'
     __select__ = has_mimetype('image/')
 
@@ -207,6 +213,7 @@
 
 
 class EHTMLView(AbstractEmbeddedView):
+    """html embedded view"""
     __regid__ = 'ehtml'
     __select__ = has_mimetype('text/html')