[Checkins] SVN: five.megrok.layout/trunk/ Update code to work with Zope 2.12.
Sylvain Viollon
sylvain at infrae.com
Thu Feb 4 10:04:47 EST 2010
Log message for revision 108762:
Update code to work with Zope 2.12.
Changed:
_U five.megrok.layout/trunk/
U five.megrok.layout/trunk/buildout.cfg
U five.megrok.layout/trunk/docs/HISTORY.txt
U five.megrok.layout/trunk/setup.py
U five.megrok.layout/trunk/src/five/megrok/layout/components.py
U five.megrok.layout/trunk/src/five/megrok/layout/ftests/layout/layout.py
U five.megrok.layout/trunk/src/five/megrok/layout/ftests/layout/page.py
U five.megrok.layout/trunk/src/five/megrok/layout/testing.py
-=-
Property changes on: five.megrok.layout/trunk
___________________________________________________________________
Added: svn:ignore
+ bin
eggs
develop-eggs
parts
var
downloads
.installed.cfg
Modified: five.megrok.layout/trunk/buildout.cfg
===================================================================
--- five.megrok.layout/trunk/buildout.cfg 2010-02-04 14:53:51 UTC (rev 108761)
+++ five.megrok.layout/trunk/buildout.cfg 2010-02-04 15:04:47 UTC (rev 108762)
@@ -1,47 +1,30 @@
[buildout]
parts =
- zope2
instance
zopepy
test
extensions = buildout.dumppickedversions
develop = .
-versions = versions
+extends = http://download.zope.org/Zope2/index/2.12.3/versions.cfg
+find-links = http://download.zope.org/Zope2/index/2.12.3
[versions]
-five.grok = 1.0
-megrok.layout = 0.8
-grokcore.annotation = 1.0.1
+Zope2 = 2.12.3
+five.grok = 1.1.1
+five.localsitemanager = 2.0.3
+grokcore.annotation = 1.2
grokcore.component = 1.7
-grokcore.formlib = 1.4
-grokcore.security = 1.2
-grokcore.site = 1.0.1
-grokcore.view = 1.12.1
+grokcore.formlib = 1.5
+grokcore.security = 1.4
+grokcore.site = 1.2
+grokcore.view = 1.12.2
grokcore.viewlet = 1.3
-five.localsitemanager = 1.1
-martian = 0.11
-zope.app.publisher = 3.5.1
-zope.app.zcmlfiles = 3.4.3
-zope.component = 3.4.0
-zope.i18n = 3.4.0
-zope.interface = 3.4.1
-zope.schema = 3.4.0
-zope.securitypolicy = 3.4.1
-zope.testing = 3.7.6
+martian = 0.11.1
+megrok.layout = 0.8
+plone.recipe.zope2instance = 4.0a4
-[zope2]
-recipe = plone.recipe.zope2install
-url = http://www.zope.org/Products/Zope/2.10.9/Zope-2.10.9-final.tgz
-fake-zope-eggs = true
-skip-fake-eggs =
- zope.component
- zope.interface
- zope.proxy
- zope.i18n
-
[instance]
recipe = plone.recipe.zope2instance
-zope2-location = ${zope2:location}
user = admin:admin
http-address = 8080
debug-mode = on
@@ -56,11 +39,9 @@
recipe = zc.recipe.egg
eggs = ${instance:eggs}
interpreter = zopepy
-extra-paths = ${zope2:location}/lib/python
scripts = zopepy
[test]
recipe = zc.recipe.testrunner
eggs = ${instance:eggs}
-extra-paths = ${zope2:location}/lib/python
defaults = ['-m', 'five.megrok.layout', '--tests-pattern', '^f?tests$', '-v']
Modified: five.megrok.layout/trunk/docs/HISTORY.txt
===================================================================
--- five.megrok.layout/trunk/docs/HISTORY.txt 2010-02-04 14:53:51 UTC (rev 108761)
+++ five.megrok.layout/trunk/docs/HISTORY.txt 2010-02-04 15:04:47 UTC (rev 108762)
@@ -4,7 +4,8 @@
1.2 (unreleased)
----------------
-- ...
+- Make ``five.megrok.layout`` work with Zope 2.12. If you whish to use
+ a previous version of Zope 2, please use ``five.megrok.layout`` 1.1.
1.1 (2009-11-24)
----------------
Modified: five.megrok.layout/trunk/setup.py
===================================================================
--- five.megrok.layout/trunk/setup.py 2010-02-04 14:53:51 UTC (rev 108761)
+++ five.megrok.layout/trunk/setup.py 2010-02-04 15:04:47 UTC (rev 108762)
@@ -27,9 +27,13 @@
include_package_data=True,
zip_safe=False,
install_requires=[
- 'setuptools',
- 'five.grok',
+ 'Zope2',
+ 'five.grok >= 1.1.1',
'grokcore.view >= 1.12.1',
+ 'martian',
'megrok.layout >= 0.8',
- ],
+ 'setuptools',
+ 'zope.component',
+ 'zope.interface',
+ ],
)
Modified: five.megrok.layout/trunk/src/five/megrok/layout/components.py
===================================================================
--- five.megrok.layout/trunk/src/five/megrok/layout/components.py 2010-02-04 14:53:51 UTC (rev 108761)
+++ five.megrok.layout/trunk/src/five/megrok/layout/components.py 2010-02-04 15:04:47 UTC (rev 108762)
@@ -13,51 +13,36 @@
##############################################################################
import megrok.layout
-from grokcore.formlib.components import default_form_template
from five import grok
from zope import component, interface
from Products.Five.browser.decode import processInputs, setPageEncoding
-import Acquisition
+class Layout(megrok.layout.Layout):
-class Layout(megrok.layout.Layout, Acquisition.Explicit):
-
grok.baseclass()
def __init__(self, *args):
super(Layout, self).__init__(*args)
if not (self.static is None):
- # static should be wrapper correctly with acquisition,
- # otherwise you will not be able to compute URL for
- # resources.
- self.static = self.static.__of__(self)
+ # Set parent to get acquisition chain
+ self.static.__parent__ = self.context
- # We let getPhysicalPath to be acquired. This make static URL's
- # work, and prevent us to inherit from Acquisition.Implicit
- getPhysicalPath = Acquisition.Acquired
+class Page(megrok.layout.Page):
-class Page(megrok.layout.Page, Acquisition.Explicit):
-
grok.baseclass()
def __init__(self, *args):
super(Page, self).__init__(*args)
if not (self.static is None):
- # static should be wrapper correctly with acquisition,
- # otherwise you will not be able to compute URL for
- # resources.
- self.static = self.static.__of__(self)
+ # Set parent to get acquisition chain
+ self.static.__parent__ = self.context
- # We let getPhysicalPath to be acquired. This make static URL's
- # work, and prevent us to inherit from Acquisition.Implicit
- getPhysicalPath = Acquisition.Acquired
+class Form(megrok.layout.Form):
-class Form(megrok.layout.Form, Acquisition.Explicit):
-
grok.baseclass()
def __init__(self, *args):
@@ -68,7 +53,7 @@
self.request, interface.Interface,
name = self.module_info.package_dotted_name)
if not (self.static is None):
- self.static = self.static.__of__(self)
+ self.static.__parent__ = self.context
def update_form(self):
processInputs(self.request)
Modified: five.megrok.layout/trunk/src/five/megrok/layout/ftests/layout/layout.py
===================================================================
--- five.megrok.layout/trunk/src/five/megrok/layout/ftests/layout/layout.py 2010-02-04 14:53:51 UTC (rev 108761)
+++ five.megrok.layout/trunk/src/five/megrok/layout/ftests/layout/layout.py 2010-02-04 15:04:47 UTC (rev 108762)
@@ -15,7 +15,7 @@
<five.megrok.layout.ftests.layout.layout.MyLayout object at ...>
>>> verifyObject(ILayout, mylayout)
True
- >>> mylayout.context.aq_base
+ >>> mylayout.context
<Mammoth at arthur>
>>> mylayout.render()
'<div> MyLayout </div>'
@@ -26,7 +26,7 @@
>>> mycontextlayout = getMultiAdapter((request, elephant), ILayout)
>>> mycontextlayout
<five.megrok.layout.ftests.layout.layout.MyContextLayout object at ...>
- >>> mycontextlayout.context.aq_base
+ >>> mycontextlayout.context
<Elephant at paul>
>>> mycontextlayout.render()
'<div> MyContextLayout </div>'
Modified: five.megrok.layout/trunk/src/five/megrok/layout/ftests/layout/page.py
===================================================================
--- five.megrok.layout/trunk/src/five/megrok/layout/ftests/layout/page.py 2010-02-04 14:53:51 UTC (rev 108761)
+++ five.megrok.layout/trunk/src/five/megrok/layout/ftests/layout/page.py 2010-02-04 15:04:47 UTC (rev 108762)
@@ -12,12 +12,9 @@
>>> request = TestRequest()
>>> root = getRootFolder()
- >>> id = root._setObject("cow", Cow(id='cow'))
- >>> cow = root._getOb("cow")
+ >>> root["cow"] = Cow(id='cow')
+ >>> cow = root["cow"]
- Hack for Zope2:
- >>> cow.REQUEST = request
-
You can now a page:
>>> myview = getMultiAdapter((cow, request), name='myview')
>>> myview
@@ -38,12 +35,9 @@
>>> print myview.content()
<p> My nice Content </p>
- >>> del cow.REQUEST
-
Here an another example:
>>> id = root._setObject("bigcow", BigCow(id='bigcow'))
>>> bigcow = root._getOb("bigcow")
- >>> bigcow.REQUEST = request
>>> mybigview = getMultiAdapter((bigcow, request), name='myview')
@@ -62,8 +56,6 @@
>>> print mybigview.content()
<p> My big cool Content </p>
- >>> del bigcow.REQUEST
-
We can even do some functional testing:
>>> browser.open('http://localhost/cow/myview')
>>> print browser.contents
Modified: five.megrok.layout/trunk/src/five/megrok/layout/testing.py
===================================================================
--- five.megrok.layout/trunk/src/five/megrok/layout/testing.py 2010-02-04 14:53:51 UTC (rev 108761)
+++ five.megrok.layout/trunk/src/five/megrok/layout/testing.py 2010-02-04 15:04:47 UTC (rev 108762)
@@ -85,6 +85,8 @@
from zope.app.testing.placelesssetup import tearDown as _cleanUp
+from Testing.ZopeTestCase.layer import ZopeLiteLayer
+
def cleanUp():
'''Cleans up the component architecture.'''
_cleanUp()
@@ -108,7 +110,7 @@
zcml.load_config('ftesting.zcml', five.megrok.layout)
setDebugMode(0)
-class Layer:
+class Layer(ZopeLiteLayer):
def setUp(cls):
'''Sets up the CA by loading etc/site.zcml.'''
More information about the checkins
mailing list