[Checkins] SVN: Sandbox/darrylcousins/mars.template/ Updates to get this old code working again

Darryl Cousins darryl at darrylcousins.net.nz
Sat Feb 9 21:25:40 EST 2008


Log message for revision 83693:
  Updates to get this old code working again

Changed:
  U   Sandbox/darrylcousins/mars.template/buildout.cfg
  U   Sandbox/darrylcousins/mars.template/setup.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/ftests/directive.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/ftests/ftesting.zcml
  U   Sandbox/darrylcousins/mars.template/src/mars/template/ftests/layout.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/ftests/minimal-ftesting.zcml
  U   Sandbox/darrylcousins/mars.template/src/mars/template/ftests/template.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/ftests/test_functional.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/meta.py

-=-
Modified: Sandbox/darrylcousins/mars.template/buildout.cfg
===================================================================
--- Sandbox/darrylcousins/mars.template/buildout.cfg	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/buildout.cfg	2008-02-10 02:25:40 UTC (rev 83693)
@@ -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.template/setup.py
===================================================================
--- Sandbox/darrylcousins/mars.template/setup.py	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/setup.py	2008-02-10 02:25:40 UTC (rev 83693)
@@ -14,14 +14,20 @@
 This package uses ``martian`` and ``grok`` to register templates
 for applications built on the ``zope`` framework.""",
     long_description=(
-        read('src/mars/template/README.txt') +
+        read('mars/template/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.template/src/mars/template/ftests/directive.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/ftests/directive.py	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/ftests/directive.py	2008-02-10 02:25:40 UTC (rev 83693)
@@ -1,10 +1,6 @@
 """
 Run through and test the available directives to template factories.
 
-  >>> import grok
-  >>> from mars.template.ftests.directive import Mammoth
-  >>> grok.grok('mars.template.ftests.directive')
-
   >>> mammoth = getRootFolder()["mammoth"] = Mammoth()
 
 Layout views have a call method (TemplateViews do not necessarily) so we will
@@ -14,16 +10,14 @@
   >>> browser = Browser()
   >>> browser.handleErrors = False
 
-  >>> browser.open("http://localhost/++skin++myskin/mammoth/@@view")
+  >>> browser.open("http://localhost/++skin++dirskin/mammoth/@@mammothview")
   >>> print browser.contents
   <body>
   <div>Rendered content</div>
   </body>
 
 """
-# TODO add layer directive, when you have a view grokker to use
 
-
 import zope.component
 import zope.interface
 
@@ -36,11 +30,11 @@
 import mars.layer
 import mars.view
 
-class IMyLayer(mars.layer.IMinimalLayer):
+class DirLayer(mars.layer.IMinimalLayer):
     pass
 
-class MySkin(grok.Skin):
-    grok.layer(IMyLayer)
+class DirSkin(grok.Skin):
+    grok.layer(DirLayer)
 
 class IMyPageTemplate(zope.interface.Interface):
     pass
@@ -48,9 +42,9 @@
 class Mammoth(grok.Model):
     pass
 
-class View(mars.view.LayoutView):
+class MammothView(mars.view.LayoutView):
     """Here use LayoutView which uses layers"""
-    grok.layer(IMyLayer)
+    grok.layer(DirLayer)
     mars.view.layout('complex') # forces named layout template lookup
     _layout_interface = IMyPageTemplate # if template provides specific interface
 
@@ -59,11 +53,11 @@
 
 class ViewLayout(mars.template.LayoutFactory):
     grok.template('templates/complex.pt') # required
-    grok.context(View) # define the adapted view
+    grok.context(MammothView) # define the adapted view
     grok.name('complex') # view must use named adapter lookup
     grok.provides(IMyPageTemplate) # view must use this interface to lookup
     mars.template.macro('body') # define the macro to use
     mars.template.content_type('text/html') # define the contentType
-    grok.layer(IMyLayer) # registered on this layer.
+    grok.layer(DirLayer) # registered on this layer.
     
 

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/ftests/ftesting.zcml
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/ftests/ftesting.zcml	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/ftests/ftesting.zcml	2008-02-10 02:25:40 UTC (rev 83693)
@@ -3,63 +3,35 @@
            i18n_domain="zope"
            package="mars.template.ftests">
 
-  <include package="grok" file="meta.zcml" />
+  <include package="grok" />
   <include package="mars.template" file="meta.zcml" />
-  <include package="mars.layer" file="meta.zcml" />
+  <include package="mars.view" file="meta.zcml" />
+  <grok:grok package="mars.template.ftests" />
 
-  <include package="zope.app.zcmlfiles" />
-
-  <!-- -->
-  <!-- -->
-
-  <include package="zope.app.securitypolicy" file="meta.zcml" />
-  <include package="zope.app.authentication" />
   <securityPolicy
-    component="zope.app.securitypolicy.zopepolicy.ZopeSecurityPolicy" />
+      component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+      />
 
-  <include package="zope.app.securitypolicy" />
+  <unauthenticatedPrincipal
+      id="zope.anybody"
+      title="Unauthenticated User"
+      />
+  <grant
+      permission="zope.View"
+      principal="zope.anybody"
+      />
 
-  <role id="zope.Anonymous" title="Everybody"
-        description="All users have this role implicitly" />
-
-  <role id="zope.Manager" title="Site Manager" />
-
   <principal
-   id="zope.manager"
-   title="Administrator"
-   login="mgr"
-   password="mgrpw" />
+      id="zope.mgr"
+      title="Manager"
+      login="mgr"
+      password="mgrpw"
+      />
 
-  <grant
-   role="zope.Manager"
-   principal="zope.manager"
-   />
-
-  <unauthenticatedPrincipal
-    id="zope.anybody"
-    title="Unauthenticated User" />
-
-  <unauthenticatedGroup
-    id="zope.Anybody"
-    title="Unauthenticated Users"
-    />
-
-  <authenticatedGroup
-    id="zope.Authenticated"
-    title="Authenticated Users"
-    />
-
-  <everybodyGroup
-    id="zope.Everybody"
-    title="All Users"
-    />
-
+  <role id="zope.Manager" title="Site Manager" />
   <grantAll role="zope.Manager" />
+  <grant role="zope.Manager" principal="zope.mgr" />
 
-
-  <include package="grok" />
-  <grok:grok package="mars.template.ftests" />
-
 </configure>
 
 

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/ftests/layout.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/ftests/layout.py	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/ftests/layout.py	2008-02-10 02:25:40 UTC (rev 83693)
@@ -1,9 +1,6 @@
 """
 LayoutFactories allow use to define page templates in python code.
 
-  >>> import grok
-  >>> from mars.template.ftests.layout import Mammoth
-
   >>> mammoth = getRootFolder()["mammoth"] = Mammoth()
 
 Layout views have a call method (TemplateViews do not necessarily) so we will

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/ftests/minimal-ftesting.zcml
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/ftests/minimal-ftesting.zcml	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/ftests/minimal-ftesting.zcml	2008-02-10 02:25:40 UTC (rev 83693)
@@ -6,7 +6,6 @@
 
   <include package="grok" file="meta.zcml" />
   <include package="mars.template" file="meta.zcml" />
-  <include package="mars.layer" file="meta.zcml" />
   <include package="mars.view" file="meta.zcml" />
 
   <include package="grok" />

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/ftests/template.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/ftests/template.py	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/ftests/template.py	2008-02-10 02:25:40 UTC (rev 83693)
@@ -1,16 +1,11 @@
 """
 TemplateFactories allow use to define page templates in python code.
 
-  >>> import grok
-  >>> from mars.template.ftests.template import Mammoth
-  >>> grok.grok('mars.template.ftests.template')
-
   >>> mammoth = Mammoth()
   >>> import zope.component
   >>> from zope.pagetemplate.interfaces import IPageTemplate
   >>> from zope.publisher.browser import TestRequest
   >>> request = TestRequest()
-  >>> from mars.template.ftests.template import View
   >>> view = View(mammoth, request)
 
 The template can then be looked up for the object that it is registered for

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/ftests/test_functional.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/ftests/test_functional.py	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/ftests/test_functional.py	2008-02-10 02:25:40 UTC (rev 83693)
@@ -7,9 +7,6 @@
 ftesting_zcml = os.path.join(os.path.dirname(__file__), 'ftesting.zcml')
 TestLayer = functional.ZCMLLayer(
                        ftesting_zcml, __name__, 'TestLayer')
-min_ftesting_zcml = os.path.join(os.path.dirname(__file__), 'minimal_ftesting.zcml')
-TestMinimalLayer = functional.ZCMLLayer(
-                       min_ftesting_zcml, __name__, 'TestMinimalLayer')
 
 optionflags = doctest.NORMALIZE_WHITESPACE + doctest.ELLIPSIS
 globs = dict(getRootFolder=functional.getRootFolder)
@@ -23,16 +20,12 @@
 def test_suite():
     suite = unittest.TestSuite()
     dottedname = 'mars.template.ftests.%s'
-    for name in ['template', 'layout']:
+    for name in ['template', 'layout', 'directive']:
         test = doctest.DocTestSuite(
-                    dottedname % name, setUp=setUp, globs=globs,
+                    dottedname % name, setUp=setUp, extraglobs=globs,
                     tearDown=tearDown, optionflags=optionflags)
         test.layer = TestLayer
         suite.addTest(test)
-    test = doctest.DocTestSuite(
-                dottedname % 'directive', setUp=setUp, globs=globs,
-                tearDown=tearDown, optionflags=optionflags)
-    test.layer = TestMinimalLayer
     suite.addTest(test)
     return suite
 

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/meta.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/meta.py	2008-02-10 02:25:06 UTC (rev 83692)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/meta.py	2008-02-10 02:25:40 UTC (rev 83693)
@@ -55,14 +55,16 @@
         view_context = determine_class_directive('grok.context',
                                                factory, module_info,
                                                default=zope.interface.Interface)
+        provides = util.class_annotation(factory, 'grok.provides', self.provides)
 
+        # now make the template factory proper
         factory = TemplateFactory(filepath, contentType, macro)
 
 
-        provides = util.class_annotation(factory, 'grok.provides', self.provides)
         zope.interface.directlyProvides(factory, provides)
 
         adapts = (view_context, view_layer)
+        #print '\n', adapts, factory, provides
 
         config.action( 
             discriminator=('adapter', adapts, provides, view_name),



More information about the Checkins mailing list