[Checkins] SVN: grok/branches/ksmith_mcweekly-layers/ Implemented tests that show static/ is not available to custom skin layers unless

Kevin Smith kevin at mcweekly.com
Wed Apr 18 12:43:25 EDT 2007


Log message for revision 74238:
  Implemented tests that show static/ is not available to custom skin layers unless
  it inherits from IDefaultBrowserLayer which as side effect inherits the ZMI
  

Changed:
  U   grok/branches/ksmith_mcweekly-layers/buildout.cfg
  U   grok/branches/ksmith_mcweekly-layers/src/grok/ftests/static/simple.py
  U   grok/branches/ksmith_mcweekly-layers/src/grok/ftests/static/simple_fixture/ellie.py

-=-
Modified: grok/branches/ksmith_mcweekly-layers/buildout.cfg
===================================================================
--- grok/branches/ksmith_mcweekly-layers/buildout.cfg	2007-04-18 14:55:25 UTC (rev 74237)
+++ grok/branches/ksmith_mcweekly-layers/buildout.cfg	2007-04-18 16:43:25 UTC (rev 74238)
@@ -1,10 +1,11 @@
 [buildout]
 develop = . grokwiki ldapaddressbook
-parts = zope3 data instance testdata testinstance test
+parts = data instance testdata testinstance test
 
 [zope3]
-recipe = zc.recipe.zope3checkout
-url = svn://svn.zope.org/repos/main/Zope3/branches/3.3
+location = /root/zope3
+#recipe = zc.recipe.zope3checkout
+#url = svn://svn.zope.org/repos/main/Zope3/branches/3.3
 
 [data]
 recipe = zc.recipe.filestorage
@@ -55,6 +56,7 @@
 recipe = zc.recipe.testrunner
 eggs = grok
 extra-paths = parts/zope3/src
+		/root/zope3/src
 working-directory = parts/testinstance
 defaults = ['--tests-pattern', '^f?tests$',
             '-v'

Modified: grok/branches/ksmith_mcweekly-layers/src/grok/ftests/static/simple.py
===================================================================
--- grok/branches/ksmith_mcweekly-layers/src/grok/ftests/static/simple.py	2007-04-18 14:55:25 UTC (rev 74237)
+++ grok/branches/ksmith_mcweekly-layers/src/grok/ftests/static/simple.py	2007-04-18 16:43:25 UTC (rev 74238)
@@ -42,4 +42,26 @@
   >>> print browser.contents
   This is yet another file.
 
+Sanity check custom layers
+
+  >>> browser.open('http://localhost/ellie/@@cavedrawings')
+  >>> print browser.contents
+  stick figures
+
+  >>> browser.open('http://localhost/++skin++Mammoth/ellie/@@tarpit')
+  >>> print browser.contents
+  inky darkness all around
+
+Static layer is not available to custom layers unless they subclass IDefaultBrowserLayer
+
+  >>> browser.open('http://localhost/++skin++Mammoth/@@/grok.ftests.static.simple_fixture/subdir/otherfile.txt')
+  Traceback (most recent call last):
+  ...
+  NotFound: ...
+
+  >>> browser.open('http://localhost/++skin++Rotterdam/@@/grok.ftests.static.simple_fixture/subdir/otherfile.txt')
+  >>> print browser.contents
+  This is yet another file.
+  
 """
+

Modified: grok/branches/ksmith_mcweekly-layers/src/grok/ftests/static/simple_fixture/ellie.py
===================================================================
--- grok/branches/ksmith_mcweekly-layers/src/grok/ftests/static/simple_fixture/ellie.py	2007-04-18 14:55:25 UTC (rev 74237)
+++ grok/branches/ksmith_mcweekly-layers/src/grok/ftests/static/simple_fixture/ellie.py	2007-04-18 16:43:25 UTC (rev 74238)
@@ -12,3 +12,20 @@
 <a tal:attributes="href static/file.txt">Some text in a file</a>
 </body>
 </html>""")
+
+class MammothSkinLayer(grok.Layer):
+    pass
+
+grok.register_skin('Mammoth', MammothSkinLayer)
+
+class CaveDrawings(grok.View):
+
+    def render(self):
+        return "stick figures"
+
+class TarPit(grok.View):
+    grok.layer(MammothSkinLayer)
+
+    def render(self):
+        return "inky darkness all around"
+    



More information about the Checkins mailing list