[Checkins] SVN: Sandbox/darrylcousins/mars.view/ Updates to get
this old code working again
Darryl Cousins
darryl at darrylcousins.net.nz
Sat Feb 9 21:27:40 EST 2008
Log message for revision 83695:
Updates to get this old code working again
Changed:
U Sandbox/darrylcousins/mars.view/buildout.cfg
U Sandbox/darrylcousins/mars.view/setup.py
U Sandbox/darrylcousins/mars.view/src/mars/view/components.py
U Sandbox/darrylcousins/mars.view/src/mars/view/ftests/ftesting.zcml
U Sandbox/darrylcousins/mars.view/src/mars/view/ftests/layout.py
U Sandbox/darrylcousins/mars.view/src/mars/view/ftests/pagelet.py
U Sandbox/darrylcousins/mars.view/src/mars/view/ftests/template.py
U Sandbox/darrylcousins/mars.view/src/mars/view/ftests/test_functional.py
U Sandbox/darrylcousins/mars.view/src/mars/view/meta.py
U Sandbox/darrylcousins/mars.view/src/mars/view/tests.py
-=-
Modified: Sandbox/darrylcousins/mars.view/buildout.cfg
===================================================================
--- Sandbox/darrylcousins/mars.view/buildout.cfg 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/buildout.cfg 2008-02-10 02:27:40 UTC (rev 83695)
@@ -1,11 +1,12 @@
[buildout]
develop = .
parts = test
-extends = http://grok.zope.org/releaseinfo/grok-0.11.1.cfg
+extends = http://download.zope.org/zope3.4/versions-3.4.0c1.cfg
versions = versions
[versions]
-martian = 0.9.2
+grok = 0.12dev
+martian = 0.9.3
[test]
recipe = zc.recipe.testrunner
Modified: Sandbox/darrylcousins/mars.view/setup.py
===================================================================
--- Sandbox/darrylcousins/mars.view/setup.py 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/setup.py 2008-02-10 02:27:40 UTC (rev 83695)
@@ -14,15 +14,21 @@
This package uses ``martian`` and ``grok`` to register views
for applications built on the ``zope`` framework.""",
long_description=(
- read('src/mars/view/README.txt') +
+ read('mars/view/README.txt') +
read('CHANGES.txt')
),
- packages=find_packages('src'),
- package_dir = {'': 'src'},
- include_package_data = True,
- zip_safe=False,
+ classifiers = ['Development Status :: 1 - Planning',
+ 'Intended Audience :: Developers',
+ 'License :: Other/Proprietary License',
+ 'Programming Language :: Python',
+ 'Operating System :: OS Independent',
+ 'Topic :: Software Development :: Build Tools',
+ 'Framework :: Zope3',
+ ],
+ packages=find_packages(),
+ namespace_packages=['mars'],
+ zip_safe=True,
license='ZPL',
- dependency_links = ['http://download.zope.org/distribution'],
extras_require = dict(
test=['zope.app.testing',
'zope.testbrowser',
Modified: Sandbox/darrylcousins/mars.view/src/mars/view/components.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/components.py 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/components.py 2008-02-10 02:27:40 UTC (rev 83695)
@@ -58,10 +58,15 @@
class LayoutView(LayoutViewBase, BrowserPage):
zope.interface.implements(IGrokView)
- __init__ = BrowserPage.__init__
+ def __init__(self, context, request):
+ BrowserPage.__init__(self, context, request)
+ self.__name__ = self.__view_name__
class PageletView(TemplateViewBase, LayoutViewBase, BrowserPage):
zope.interface.implements(IPagelet, IGrokView)
- __init__ = BrowserPage.__init__
+ def __init__(self, context, request):
+ BrowserPage.__init__(self, context, request)
+ self.__name__ = self.__view_name__
+
Modified: Sandbox/darrylcousins/mars.view/src/mars/view/ftests/ftesting.zcml
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/ftests/ftesting.zcml 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/ftests/ftesting.zcml 2008-02-10 02:27:40 UTC (rev 83695)
@@ -3,13 +3,35 @@
i18n_domain="zope"
package="mars.view.ftests">
- <include package="grok" file="meta.zcml" />
+ <include package="grok" />
<include package="mars.template" file="meta.zcml" />
<include package="mars.view" file="meta.zcml" />
-
- <include package="grok" />
<grok:grok package="mars.view.ftests" />
+ <securityPolicy
+ component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+ />
+
+ <unauthenticatedPrincipal
+ id="zope.anybody"
+ title="Unauthenticated User"
+ />
+ <grant
+ permission="zope.View"
+ principal="zope.anybody"
+ />
+
+ <principal
+ id="zope.mgr"
+ title="Manager"
+ login="mgr"
+ password="mgrpw"
+ />
+
+ <role id="zope.Manager" title="Site Manager" />
+ <grantAll role="zope.Manager" />
+ <grant role="zope.Manager" principal="zope.mgr" />
+
</configure>
Modified: Sandbox/darrylcousins/mars.view/src/mars/view/ftests/layout.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/ftests/layout.py 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/ftests/layout.py 2008-02-10 02:27:40 UTC (rev 83695)
@@ -1,8 +1,6 @@
"""
Testing the LayoutView, which unlike grok.View will look up a layout.
- >>> import zope.component
- >>> from mars.view.ftests.layout import Mammoth
>>> mammoth = getRootFolder()["manfred"] = Mammoth()
>>> from zope.testbrowser.testing import Browser
@@ -11,18 +9,13 @@
These tests make use of minimal layer
- >>> skinURL = 'http://localhost/++skin++myskin'
+ >>> skinURL = 'http://localhost/++skin++layoutskin'
Since a layout template is not yet registered, calling the view will fail:
- >>> browser.open("http://localhost/manfred/drawing")
+ >>> browser.open(skinURL + "/manfred/@@drawing")
Traceback (most recent call last):
...
- NotFound: ......
-
- >>> browser.open(skinURL + "/manfred/drawing")
- Traceback (most recent call last):
- ...
ComponentLookupError: ......
We'll manually register a layout template.
@@ -41,6 +34,7 @@
>>> from zope.publisher.interfaces.browser import IBrowserRequest
>>> from mars.view.ftests.layout import Drawing
>>> factory = TemplateFactory(layout, 'text/html')
+ >>> import zope.component
>>> zope.component.provideAdapter(factory,
... (Drawing, IBrowserRequest), ILayoutTemplate)
@@ -53,8 +47,7 @@
We can also use mars.template to provide the layout template.
- >>> #browser.open(skinURL + "/manfred/@@view")
- >>> browser.open("http://localhost/manfred/@@view")
+ >>> browser.open(skinURL + "/manfred/@@view")
>>> print browser.contents
<div>View template</div>
@@ -64,23 +57,22 @@
import mars.template
import mars.layer
-class IMyLayer(mars.layer.IMinimalLayer):
+class LayoutLayer(mars.layer.IMinimalLayer):
pass
# set layer on module level, all class declarations that may use directive
# grok.layer will use this layer - Skin, views and templates
from zope.publisher.interfaces.browser import IDefaultBrowserLayer
-grok.layer(IMyLayer)
+grok.layer(LayoutLayer)
-class MySkin(grok.Skin):
- grok.layer(IMyLayer)
+class LayoutSkin(grok.Skin):
+ pass
class Mammoth(grok.Model):
pass
-#class Drawing(mars.view.LayoutView):
-class Drawing(grok.View):
- grok.layer(IMyLayer)
+class Drawing(mars.view.LayoutView):
+#class Drawing(grok.View):
def render(self):
return u'Rendered content'
Modified: Sandbox/darrylcousins/mars.view/src/mars/view/ftests/pagelet.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/ftests/pagelet.py 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/ftests/pagelet.py 2008-02-10 02:27:40 UTC (rev 83695)
@@ -1,7 +1,6 @@
"""
Testing the PageletView, which unlike grok.View will look up a layout.
- >>> from mars.view.ftests.pagelet import Mammoth
>>> getRootFolder()["manfred"] = Mammoth()
>>> from zope.testbrowser.testing import Browser
@@ -10,7 +9,7 @@
These tests make use of minimal layer
- >>> skinURL = 'http://localhost/++skin++myskin'
+ >>> skinURL = 'http://localhost/++skin++pageletskin'
Pagelet will use two templates, one rendered and returned from ``render`` method
and the second - a layout template - on ``__call__`` method.
@@ -30,14 +29,14 @@
import mars.template
import mars.layer
-class IMyLayer(mars.layer.IMinimalLayer):
+class PageletLayer(mars.layer.IMinimalLayer):
pass
# set layer on module level, all class declarations that use directive
# mars.layer.layer will use this layer - Skin, views and templates
-grok.layer(IMyLayer)
+grok.layer(PageletLayer)
-class MySkin(grok.Skin):
+class PageletSkin(grok.Skin):
pass
class Mammoth(grok.Model):
Modified: Sandbox/darrylcousins/mars.view/src/mars/view/ftests/template.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/ftests/template.py 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/ftests/template.py 2008-02-10 02:27:40 UTC (rev 83695)
@@ -1,7 +1,6 @@
"""
Testing the TemplateView, which unlike grok.View will look up a template.
- >>> from mars.view.ftests.template import Mammoth, Painting
>>> mammoth = getRootFolder()["manfred"] = Mammoth()
>>> from zope.testbrowser.testing import Browser
Modified: Sandbox/darrylcousins/mars.view/src/mars/view/ftests/test_functional.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/ftests/test_functional.py 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/ftests/test_functional.py 2008-02-10 02:27:40 UTC (rev 83695)
@@ -1,3 +1,4 @@
+import os
import unittest
from zope.testing import doctest
@@ -3,8 +4,12 @@
from zope.app.testing.functional import FunctionalTestSetup, getRootFolder
from zope.app.testing import functional
-functional.defineLayer('TestLayer', 'ftesting.zcml')
+ftesting_zcml = os.path.join(os.path.dirname(__file__), 'ftesting.zcml')
+TestLayer = functional.ZCMLLayer(
+ ftesting_zcml, __name__, 'TestLayer')
+
+
optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
-globs = dict(getRootFolder=getRootFolder)
+extraglobs = dict(getRootFolder=getRootFolder)
def setUp(test):
@@ -17,14 +22,10 @@
def test_suite():
suite = unittest.TestSuite()
dottedname = 'mars.view.ftests.%s'
- #for name in ['layout', 'template', 'pagelet']:
- for name in ['layout']:
+ for name in ['layout', 'template', 'pagelet']:
test = doctest.DocTestSuite(
- dottedname % name, setUp=setUp, globs=globs,
+ dottedname % name, setUp=setUp, extraglobs=extraglobs,
tearDown=tearDown, optionflags=optionflags)
test.layer = TestLayer
suite.addTest(test)
return suite
-
-if __name__ == '__main__':
- unittest.main(defaultTest='test_suite')
Modified: Sandbox/darrylcousins/mars.view/src/mars/view/meta.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/meta.py 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/meta.py 2008-02-10 02:27:40 UTC (rev 83695)
@@ -60,9 +60,8 @@
# sub classes must provide the registration
self.register(factory, config)
- if self.view_name == 'drawing':
- print '\n'.join([str(factory), str(self.view_context),
- str(self.view_layer), str(self.view_name), str(self.provides)])
+ #print '\n'.join([str(factory), str(self.view_context),
+ # str(self.view_layer), str(self.view_name), str(self.provides)])
permission = get_default_permission(factory)
config.action(
Modified: Sandbox/darrylcousins/mars.view/src/mars/view/tests.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/tests.py 2008-02-10 02:26:40 UTC (rev 83694)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/tests.py 2008-02-10 02:27:40 UTC (rev 83695)
@@ -31,11 +31,6 @@
[None],
)
- # register provider TALES
- from zope.app.pagetemplate import metaconfigure
- from zope.contentprovider import tales
- metaconfigure.registerType('provider', tales.TALESProviderExpression)
-
def test_suite():
suite = unittest.TestSuite()
suite.addTests([doctest.DocFileSuite('view.txt',
More information about the Checkins
mailing list