[Checkins] SVN: five.grok/trunk/ Improve README.txt / Add tests.

Sylvain Viollon sylvain at infrae.com
Wed Jun 10 12:59:44 EDT 2009


Log message for revision 100802:
  Improve README.txt / Add tests.
  
  

Changed:
  U   five.grok/trunk/README.txt
  A   five.grok/trunk/src/five/grok/ftests/site/folder_site.py

-=-
Modified: five.grok/trunk/README.txt
===================================================================
--- five.grok/trunk/README.txt	2009-06-10 14:41:35 UTC (rev 100801)
+++ five.grok/trunk/README.txt	2009-06-10 16:59:44 UTC (rev 100802)
@@ -31,7 +31,7 @@
 
 - Page Templates (using the Zope 2 Page Templates),
 
-- Formlib forms.
+- Formlib forms,
 
 - Local sites and utilities.
 
@@ -56,13 +56,44 @@
 ~~~~
 
 ``five.grok`` have some dependencies on Zope 3 eggs. With Zope 2, you
-can fake those dependencies in buildout by using the option
-``fake-zope-eggs = true`` of ``plone.recipe.zope2instance``. However,
-``five.grok`` requires ``zope.component`` 3.4 at least. You can
-exclude that egg by mentioning ``zope.component`` in the option
-``skip-fake-eggs`` in the same buildout section.
+can fake those dependencies in buildout with the help of
+``plone.recipe.zope2instance``.
 
+The minium required configuration to install Zope would be::
 
+  [zope2]
+  recipe = plone.recipe.zope2install
+  url = Please complete here correctly
+  fake-zope-eggs = true
+  additional-fake-eggs =
+     ZODB3
+  skip-fake-eggs =
+     zope.app.publisher
+     zope.component
+     zope.i18n
+     zope.interface
+     zope.testing
+
+
+And for this release we recommand to pin down the following version in
+your buildout::
+
+  grokcore.component = 1.6
+  grokcore.formlib = 1.1
+  grokcore.security = 1.0
+  grokcore.view = 1.7
+  grokcore.viewlet = 1.0
+  five.localsitemanager = 1.0
+  martian = 0.11
+  zope.app.publisher = 3.5.1
+  zope.component = 3.4
+  zope.i18n = 3.6.0
+  zope.interface = 3.5.0
+  zope.testing = 3.7.1
+
+Zope 2.10 is required as bare minimum.
+
+
 More information
 ----------------
 

Added: five.grok/trunk/src/five/grok/ftests/site/folder_site.py
===================================================================
--- five.grok/trunk/src/five/grok/ftests/site/folder_site.py	                        (rev 0)
+++ five.grok/trunk/src/five/grok/ftests/site/folder_site.py	2009-06-10 16:59:44 UTC (rev 100802)
@@ -0,0 +1,69 @@
+"""
+  >>> from five.grok.ftests.site.folder_site import *
+  >>> universe = getRootFolder()
+
+  >>> universe._setObject("earth", World(id="earth"))
+  'earth'
+
+  >>> from zope.app.component.site import setSite
+  >>> setSite(universe.earth)
+
+  >>> universe.earth.objectIds()
+  ['energy']
+  >>> universe.earth.energy
+  <ConfigurableEnergyManager at /earth/>
+  >>> from zope import component
+  >>> from zope.interface.verify import verifyObject
+  >>> manager = component.getUtility(IEnergyManager)
+  >>> manager
+  <ConfigurableEnergyManager at /earth/>
+  >>> manager.aq_parent
+  <World at ...>
+  >>> verifyObject(IEnergyManager, manager)
+  True
+  >>> manager.power_on()
+  Light Red On!
+  >>> universe.earth.energy.cool_option = 'Blue'
+  >>> manager.power_on()
+  Light Blue On!
+
+"""
+
+from zope.interface import Interface
+from five import grok
+
+
+class IEnergyManager(Interface):
+
+    def power_on():
+        """Power up the world.
+        """
+
+    def power_off():
+        """Shutdown the world.
+        """
+
+
+class ConfigurableEnergyManager(grok.LocalUtility):
+
+    grok.implements(IEnergyManager)
+
+    cool_option = 'clean'
+
+    def power_on(self):
+        print "Light "+ self.cool_option + " On!"
+
+    def power_off(self):
+        print "Light " + self.cool_option + " Off!"
+
+
+def setup_energy(manager):
+    manager.cool_option = 'Red'
+
+class World(grok.Container, grok.Site):
+
+    grok.local_utility(ConfigurableEnergyManager, IEnergyManager,
+                       public=True,
+                       name_in_container='energy',
+                       setup=setup_energy)
+



More information about the Checkins mailing list