[Checkins] SVN: grok/trunk/doc/reference/ document the grok.getApplication and grok.util.application_url functions

Kevin Teague kevin at bud.ca
Wed Dec 9 20:14:04 EST 2009


Log message for revision 106362:
  document the grok.getApplication and grok.util.application_url functions

Changed:
  U   grok/trunk/doc/reference/functions.rst
  U   grok/trunk/doc/reference/utils.rst

-=-
Modified: grok/trunk/doc/reference/functions.rst
===================================================================
--- grok/trunk/doc/reference/functions.rst	2009-12-10 00:57:11 UTC (rev 106361)
+++ grok/trunk/doc/reference/functions.rst	2009-12-10 01:14:04 UTC (rev 106362)
@@ -78,6 +78,16 @@
     :func:`grok.AutoFields`, :class:`grok.Form`
 
 
+:func:`grok.getApplication`
+====================
+
+.. function:: grok.getApplication()
+
+    Get the current application object or the nearest enclosing
+    `grok.Application` object. Raises ValueError if no Application can
+    be found.
+
+
 :func:`grok.getSite`
 ====================
 
@@ -89,7 +99,10 @@
 
     Site objects are instances of :class:`grok.Site`. Typically this will 
     also be your main :class:`grok.Application` root object, which inherits
-    from :class:`grok.Site`.
+    from :class:`grok.Site`. Normally you will want to use
+    `grok.getApplication` to get the application object, as `grok.getSite`
+    can return enclosed sub-sites in applications with more complex
+    configuration.
 
 .. seealso::
 

Modified: grok/trunk/doc/reference/utils.rst
===================================================================
--- grok/trunk/doc/reference/utils.rst	2009-12-10 00:57:11 UTC (rev 106361)
+++ grok/trunk/doc/reference/utils.rst	2009-12-10 01:14:04 UTC (rev 106362)
@@ -5,6 +5,48 @@
 The :mod:`grok.util` module provides functions which are less commonly
 used, and so are not available for import directly from the :mod:`grok` module.
 
+:func:`grok.util.application_url`
+=================================
+
+.. function:: grok.util.application_url(request, obj, name=None, data={})`
+
+    Return the URL of the nearest enclosing `grok.Application`.
+
+    Raises ValueError if no Application can be found.
+    
+    This function is also available as a method on the `grok.View` class.
+
+
+:func:`grok.util.applySkin`
+===========================
+
+.. function:: grok.util.applySkin(request, skin, skin_type)
+
+    Change the presentation skin for this request.
+
+
+:func:`grok.util.create_application`
+====================================
+
+.. function:: grok.util.create_application(factory, container, name)
+
+    Creates an application and triggers the events from
+    the application lifecycle.
+
+
+:func:`grok.util.getApplication`
+================================
+
+.. function:: grok.util.getApplication()
+
+    Return the nearest enclosing `grok.Application`.
+
+    Raises ValueError if no Application can be found.
+
+    This function is also export to the main grok namespace and can be
+    called at `grok.getApplication`.
+
+
 :func:`grok.util.make_checker`
 ==============================
 
@@ -15,6 +57,7 @@
     These could be one and the same for normal views, or different
     in case we make method-based views such as for JSON and XMLRPC.
 
+
 :func:`grok.util.safely_locate_maybe`
 =====================================
 
@@ -26,17 +69,4 @@
     If the object provides ILocation, __parent__ and __name__ will be
     set directly.  A location proxy will be returned otherwise.
 
-:func:`grok.util.applySkin`
-===========================
 
-.. function:: grok.util.applySkin(request, skin, skin_type)
-
-    Change the presentation skin for this request.
-
-:func:`grok.util.create_application`
-====================================
-
-.. function:: grok.util.create_application(factory, container, name)
-
-    Creates an application and triggers the events from
-    the application lifecycle.



More information about the checkins mailing list