[Checkins] SVN: five.grok/trunk/ Start to integrate support for local site.
Sylvain Viollon
sylvain at infrae.com
Fri Jun 5 11:51:29 EDT 2009
Log message for revision 100658:
Start to integrate support for local site.
Changed:
U five.grok/trunk/README.txt
U five.grok/trunk/buildout.cfg
U five.grok/trunk/docs/HISTORY.txt
U five.grok/trunk/setup.py
U five.grok/trunk/src/five/grok/__init__.py
U five.grok/trunk/src/five/grok/configure.zcml
A five.grok/trunk/src/five/grok/ftests/site/
A five.grok/trunk/src/five/grok/ftests/site/__init__.py
A five.grok/trunk/src/five/grok/ftests/site/local_site.py
U five.grok/trunk/src/five/grok/ftests/test_grok_functional.py
U five.grok/trunk/src/five/grok/meta.zcml
-=-
Modified: five.grok/trunk/README.txt
===================================================================
--- five.grok/trunk/README.txt 2009-06-05 15:51:11 UTC (rev 100657)
+++ five.grok/trunk/README.txt 2009-06-05 15:51:29 UTC (rev 100658)
@@ -21,7 +21,7 @@
Coming from Grok, the following components are available to Zope 2
developers:
-- Zope 3 Component (Adapter, Utility, Subscribers),
+- Zope 3 Component (Adapter, Global utilities, Subscribers),
- Permissions,
@@ -33,6 +33,8 @@
- Formlib forms.
+- Local sites and utilities.
+
All those components are available with exactly the same syntax than
in grok. You just have to do::
Modified: five.grok/trunk/buildout.cfg
===================================================================
--- five.grok/trunk/buildout.cfg 2009-06-05 15:51:11 UTC (rev 100657)
+++ five.grok/trunk/buildout.cfg 2009-06-05 15:51:29 UTC (rev 100658)
@@ -5,6 +5,7 @@
zopepy
test
develop = .
+ devel/grokcore.site
versions = versions
newest = false
@@ -12,6 +13,8 @@
recipe = plone.recipe.zope2install
url = http://www.zope.org/Products/Zope/2.10.5/Zope-2.10.5-final.tgz
fake-zope-eggs = true
+additional-fake-eggs =
+ ZODB3
skip-fake-eggs =
zope.app.publisher
zope.component
Modified: five.grok/trunk/docs/HISTORY.txt
===================================================================
--- five.grok/trunk/docs/HISTORY.txt 2009-06-05 15:51:11 UTC (rev 100657)
+++ five.grok/trunk/docs/HISTORY.txt 2009-06-05 15:51:29 UTC (rev 100658)
@@ -4,9 +4,12 @@
five.grok - 1.0b1 (unreleased)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* Fix EditForm when used with grokcore.formlib 1.1. The Apply actions
- was gone. [thefunny42]
+* Added support for local site and utilities with `grokcore.site`_.
+ [thefunny42]
+* Fix grok.EditForm when used with grokcore.formlib 1.1. The Apply
+ action was gone. [thefunny42]
+
* Let static resource directories allow access to unprotected subattributes
to avoid authorisation problems when accessing them from protected code.
[optilude]
@@ -15,6 +18,7 @@
not actually exist.
[optilude]
+
five.grok - 1.0a2 (2008-11-23)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -67,6 +71,7 @@
views).
[regebro, gotcha]
+.. _grokcore.site: http://pypi.python.org/pypi/grokcore.site
.. _grokcore.view: http://pypi.python.org/pypi/grokcore.view
.. _grokcore.viewlet: http://pypi.python.org/pypi/grokcore.viewlet
.. _grokcore.formlib: http://pypi.python.org/pypi/grokcore.formlib
Modified: five.grok/trunk/setup.py
===================================================================
--- five.grok/trunk/setup.py 2009-06-05 15:51:11 UTC (rev 100657)
+++ five.grok/trunk/setup.py 2009-06-05 15:51:29 UTC (rev 100658)
@@ -34,5 +34,6 @@
'grokcore.view >= 1.2',
'grokcore.viewlet',
'grokcore.security',
+ 'grokcore.site',
],
)
Modified: five.grok/trunk/src/five/grok/__init__.py
===================================================================
--- five.grok/trunk/src/five/grok/__init__.py 2009-06-05 15:51:11 UTC (rev 100657)
+++ five.grok/trunk/src/five/grok/__init__.py 2009-06-05 15:51:29 UTC (rev 100658)
@@ -14,6 +14,7 @@
from grokcore.component import *
from grokcore.security import *
+from grokcore.site import *
from grokcore.view import *
from grokcore.viewlet import *
from grokcore.formlib import *
Modified: five.grok/trunk/src/five/grok/configure.zcml
===================================================================
--- five.grok/trunk/src/five/grok/configure.zcml 2009-06-05 15:51:11 UTC (rev 100657)
+++ five.grok/trunk/src/five/grok/configure.zcml 2009-06-05 15:51:29 UTC (rev 100658)
@@ -6,6 +6,7 @@
<include package="five.grok" file="meta.zcml" />
+ <include package="grokcore.site" />
<include package="grokcore.view" />
<include package="grokcore.viewlet" />
@@ -14,6 +15,13 @@
name="index"
/>
+ <!-- ZCML of zope.app.container to add local utility to local site -->
+ <adapter
+ provides="zope.app.container.interfaces.INameChooser"
+ for="zope.app.container.interfaces.IWriteContainer"
+ factory="zope.app.container.contained.NameChooser"
+ />
+
<permission
id="zope.View"
title="View"
Property changes on: five.grok/trunk/src/five/grok/ftests/site/__init__.py
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Added: five.grok/trunk/src/five/grok/ftests/site/local_site.py
===================================================================
--- five.grok/trunk/src/five/grok/ftests/site/local_site.py (rev 0)
+++ five.grok/trunk/src/five/grok/ftests/site/local_site.py 2009-06-05 15:51:29 UTC (rev 100658)
@@ -0,0 +1,53 @@
+"""
+ >>> from five.grok.ftests.site.local_site import *
+ >>> universe = getRootFolder()
+
+ >>> universe._setObject("earth", World(id="earth"))
+ 'earth'
+ >>> from zope.app.component import interfaces
+ >>> from zope.interface.verify import verifyObject
+ >>> verifyObject(interfaces.ISite, universe.earth)
+ True
+
+ >>> from zope.app.component.site import setSite
+ >>> setSite(universe.earth)
+
+ >>> from zope import component
+ >>> manager = component.getUtility(IEnergyManager)
+ >>> manager
+ <five.grok.ftests.site.local_site.EnergyManager object at ...>
+ >>> verifyObject(IEnergyManager, manager)
+ True
+
+"""
+
+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 EnergyManager(grok.LocalUtility):
+
+ grok.implements(IEnergyManager)
+
+ def power_on(self):
+ print "Light On!"
+
+ def power_off(self):
+ print "Light Off!"
+
+
+class World(grok.Model, grok.Site):
+
+ grok.local_utility(EnergyManager, IEnergyManager)
+
Property changes on: five.grok/trunk/src/five/grok/ftests/site/local_site.py
___________________________________________________________________
Added: svn:keywords
+ Author Date Id Revision
Modified: five.grok/trunk/src/five/grok/ftests/test_grok_functional.py
===================================================================
--- five.grok/trunk/src/five/grok/ftests/test_grok_functional.py 2009-06-05 15:51:11 UTC (rev 100657)
+++ five.grok/trunk/src/five/grok/ftests/test_grok_functional.py 2009-06-05 15:51:29 UTC (rev 100658)
@@ -62,7 +62,7 @@
def test_suite():
suite = unittest.TestSuite()
- for name in ['directoryresource', 'view', 'viewlet','form']:
+ for name in ['directoryresource', 'view', 'viewlet','form', 'site']:
suite.addTest(suiteFromPackage(name))
return suite
Modified: five.grok/trunk/src/five/grok/meta.zcml
===================================================================
--- five.grok/trunk/src/five/grok/meta.zcml 2009-06-05 15:51:11 UTC (rev 100657)
+++ five.grok/trunk/src/five/grok/meta.zcml 2009-06-05 15:51:29 UTC (rev 100658)
@@ -5,6 +5,7 @@
<include package="grokcore.component" file="meta.zcml" />
<include package="grokcore.security" file="meta.zcml" />
+ <include package="grokcore.site" file="meta.zcml" />
<!-- Load minimal support of grokcore.view, views + templates -->
<include package="grokcore.view" file="meta-minimal.zcml" />
More information about the Checkins
mailing list