[Checkins] SVN: grokcore.site/trunk/ Work on the README.

Sylvain Viollon sylvain at infrae.com
Fri Jun 5 11:13:21 EDT 2009


Log message for revision 100653:
  Work on the README.
  
  

Changed:
  U   grokcore.site/trunk/README.txt
  U   grokcore.site/trunk/src/grokcore/site/__init__.py

-=-
Modified: grokcore.site/trunk/README.txt
===================================================================
--- grokcore.site/trunk/README.txt	2009-06-05 14:57:49 UTC (rev 100652)
+++ grokcore.site/trunk/README.txt	2009-06-05 15:13:20 UTC (rev 100653)
@@ -8,18 +8,75 @@
 Setting up ``grokcore.site``
 ============================
 
+This package is essentially set up like the `grokcore.component`_
+package, please refer to its documentation for details.  The only
+additional ZCML line you will need is::
 
+  <include package="grokcore.site" file="meta.zcml" />
+
+Put this somewhere near the top of your root ZCML file but below the
+line where you include ``grokcore.component``'s configuration.
+
+
 Examples
 ========
 
+Global utilities are already managed by `grokcore.component`_.
 
+Here a simple example of a local utility::
+
+  from zope.interface import implements, Interface
+  import grokcore.site
+
+  class IKangaroo(Interface):
+
+      def jump():
+         """Make all kangaroos jump somewhere.
+         """
+
+  class KangarooUtility(grokcore.site.LocalUtility):
+      implements(IKangaroo)
+
+      def jump(self):
+          pass
+
+
+Now, we can register our utility to a local site. That will create
+automatically, and register that utility when we create that site::
+
+
+   class Jungle(grokcore.site.Site):
+
+       grokcore.site.local_utility(KangarooUtility, IKangaroo)
+
+
+If you don't add the last line, you will still have your site, but
+nothing to make jump your kangaroo. Then, you will be able to add
+manually by hand after (if you want).
+
+
 API Overview
 ============
 
 Base classes
 ------------
 
+``Site``
+   Base class for your site.
 
+``LocalUtility``
+   Base class for a ZODB-persitent local utility.
+
+
 Directives
 ----------
 
+``local_utility(factory, provides=None, name=u'', setup=None, public=False, name_in_container=None``)
+   Directive used on a site to register a local utility at the
+   creation time.
+
+
+In addition, the ``grokcore.security`` package exposes the
+`grokcore.component`_ API.
+
+.. _grokcore.component: http://pypi.python.org/pypi/grokcore.component

Modified: grokcore.site/trunk/src/grokcore/site/__init__.py
===================================================================
--- grokcore.site/trunk/src/grokcore/site/__init__.py	2009-06-05 14:57:49 UTC (rev 100652)
+++ grokcore.site/trunk/src/grokcore/site/__init__.py	2009-06-05 15:13:20 UTC (rev 100653)
@@ -12,8 +12,9 @@
 #
 ##############################################################################
 
+
+from grokcore.component import *
 from grokcore.site.directive import local_utility
-from grokcore.component import provides
 from grokcore.site.components import Site, LocalUtility
 
 import grokcore.site.testing



More information about the Checkins mailing list