[Checkins] SVN: megrok.quarry/trunk/ * 0.2 Bug fixes - restrict zc.catalog to 1.1.1, update setup.py, remove

Kevin Smith kevin at mcweekly.com
Thu May 24 14:21:52 EDT 2007


Log message for revision 75946:
  * 0.2 Bug fixes - restrict zc.catalog to 1.1.1, update setup.py, remove
    stray render method in quarry.View (as reported by Christian Klinger), 
    fix demo.
  
    Add Set, Value, DatetimeValue, DatetimeSet from zc.catalog.
  
    Add quarry.ContentProvider - viewlets are content providers managed by a
    viewlet manager. A content provider then, is registered _directly_ to
    a view.
  
    Update README.txt
  
  

Changed:
  U   megrok.quarry/trunk/README.txt
  U   megrok.quarry/trunk/buildout.cfg
  U   megrok.quarry/trunk/setup.py
  U   megrok.quarry/trunk/src/megrok/quarry/components.py
  U   megrok.quarry/trunk/src/megrok/quarry/demo/app.py
  U   megrok.quarry/trunk/src/megrok/quarry/demo/demoshare.py
  U   megrok.quarry/trunk/src/megrok/quarry/meta.py

-=-
Modified: megrok.quarry/trunk/README.txt
===================================================================
--- megrok.quarry/trunk/README.txt	2007-05-24 15:18:53 UTC (rev 75945)
+++ megrok.quarry/trunk/README.txt	2007-05-24 18:21:51 UTC (rev 75946)
@@ -8,12 +8,29 @@
 
 As of 0.9dev, Grok has no way of associating different views with different skins.
 MEGROK.QUARRY is an implementation of skins, layers and template re-use. It is
-useable today and based on discussions from the mailing list. It is hoped these 
-new directives and grokkers will be considered for inclusion in the core one day.
+useable today and based on discussions from the mailing list. 
 
+There is nothing here that can't already be done in Zope3, this just simplifies the
+registration the Grok way.
+
+** CAUTION: This package is considered highly experimental. That means it will change
+quite often. Hopefully some gems can be mined out of these proofs of concept. :)
+
+
+
 Change Log
 ----------
 
+
+* 0.2 Bug fixes - restrict zc.catalog to 1.1.1, update setup.py, remove
+  stray render method in quarry.View, fix urls in demo
+  
+  Add Set, Value, DatetimeValue, DatetimeSet from zc.catalog
+
+  Add quarry.ContentProvider - viewlets are content providers managed by a
+  viewlet manager. A content provider then, is registered _directly_ to
+  a view.
+
 * 0.1 initial checkin
 
 Current Enhancements
@@ -175,6 +192,7 @@
 Menu10 appears first and Menu30 appears last.
 
 
+
 install
 -------
 
@@ -185,20 +203,21 @@
 Todo
 ----
 
+* TESTS, TESTS, TEST!!!
 * better documentation
 * quarry.TALNamespace
-* tests, tests, tests, currently they are intertwined in a seperate project
 * currently grok.Layer inherits from IDefaultBrowserLayer, don't do this
+* Experiment with quarry.groklets. For the common case, a viewlet manager
+  is just an extra step. Groklets, like a content provider,  can be 
+  registered directly with a view, but with multiple groklets assigned 
+  per provider like a viewlet.
 
 
 Thank You
 ---------
 
-The Grok team lead by Martijn and Philipp and Zope3 community for making web programming
-entirely too much fun.  :)
+To the Grok team for making web programming entirely too much fun.  :)
 
->>>>>>> MERGE-SOURCE
 
 
 
-

Modified: megrok.quarry/trunk/buildout.cfg
===================================================================
--- megrok.quarry/trunk/buildout.cfg	2007-05-24 15:18:53 UTC (rev 75945)
+++ megrok.quarry/trunk/buildout.cfg	2007-05-24 18:21:51 UTC (rev 75946)
@@ -17,7 +17,12 @@
 [buildout]
 parts = zope3 data instance test
 develop = .
+versions = release-1
 
+[release-1]
+zc.catalog= 1.1.1
+
+
 [instance]
 database = data
 eggs = setuptools

Modified: megrok.quarry/trunk/setup.py
===================================================================
--- megrok.quarry/trunk/setup.py	2007-05-24 15:18:53 UTC (rev 75945)
+++ megrok.quarry/trunk/setup.py	2007-05-24 18:21:51 UTC (rev 75946)
@@ -21,6 +21,7 @@
       zip_safe=False,
       install_requires=['setuptools',
                         'grok',
+                        'zc.catalog==1.1.1',
                         # -*- Extra requirements: -*-
                         ],
       entry_points="""

Modified: megrok.quarry/trunk/src/megrok/quarry/components.py
===================================================================
--- megrok.quarry/trunk/src/megrok/quarry/components.py	2007-05-24 15:18:53 UTC (rev 75945)
+++ megrok.quarry/trunk/src/megrok/quarry/components.py	2007-05-24 18:21:51 UTC (rev 75946)
@@ -117,17 +117,6 @@
     def update(self):
         pass
 
-    def render(self):
-        mapply(self.update, (), self.request)
-        if self.request.response.getStatus() in (302, 303):
-            # A redirect was triggered somewhere in update().  Don't
-            # continue rendering the template or doing anything else.
-            return
-
-        template = getattr(self, 'template', None)
-        if template is not None:
-            return self._render_template()
-
     
     def __getitem__(self, key):
         # XXX give nice error message if template is None

Modified: megrok.quarry/trunk/src/megrok/quarry/demo/app.py
===================================================================
--- megrok.quarry/trunk/src/megrok/quarry/demo/app.py	2007-05-24 15:18:53 UTC (rev 75945)
+++ megrok.quarry/trunk/src/megrok/quarry/demo/app.py	2007-05-24 18:21:51 UTC (rev 75946)
@@ -13,9 +13,6 @@
 
 
 
-
-
-
 # skins and layers
 
 class TestLayer(quarry.Layer):
@@ -29,17 +26,30 @@
 
 
 class TestView(quarry.View):
+
+    def skinned_url(self):
+        url = self.url(self.context, '@@hiddenview').split('/')[3:]
+        return "/++skin++test/" + '/'.join(url)
     
     def render(self):
-        return """<html><body><h1>GROK NO HIDE</h1>
-        Now try http:://yourhost/++skin++test/yourdemo/@@hiddenview
-        </body></html>"""
+        return """<html><body><h1>WHERE'S GROK</h1>
+        Now try <a href="%(url)s">%(url)s</a>
+        </body></html>""" % {'url': self.skinned_url()}
 
+    
+class HiddenView(quarry.View):
+    quarry.layer(TestLayer)
 
+    def render(self):
+        return """
+        <html><body><h1>HERE GROK IS</h1>
+        </body></html>
+        """
 
 
 
 
+
 # viewlets
 
 class MenuPage(quarry.View):

Modified: megrok.quarry/trunk/src/megrok/quarry/demo/demoshare.py
===================================================================
--- megrok.quarry/trunk/src/megrok/quarry/demo/demoshare.py	2007-05-24 15:18:53 UTC (rev 75945)
+++ megrok.quarry/trunk/src/megrok/quarry/demo/demoshare.py	2007-05-24 18:21:51 UTC (rev 75946)
@@ -10,8 +10,8 @@
 <html><body>
 <h2>GROK SMASH ZCML!</h2>
 <ul>
-<li><a href="./@@testview">Test Skins & Layers</a></li>
-<li><a href="./@@menu">Viewlet Test Page</a></li>
+<li><a href="./@@testview" tal:attributes="href python:view.url(context, '@@testview')">Test Skins & Layers</a></li>
+<li><a href="./@@menu" tal:attributes="href python:view.url(context, '@@menu')">Viewlet Test Page</a></li>
 </ul>
 </body></html>
 """)

Modified: megrok.quarry/trunk/src/megrok/quarry/meta.py
===================================================================
--- megrok.quarry/trunk/src/megrok/quarry/meta.py	2007-05-24 15:18:53 UTC (rev 75945)
+++ megrok.quarry/trunk/src/megrok/quarry/meta.py	2007-05-24 18:21:51 UTC (rev 75946)
@@ -107,6 +107,7 @@
                 util.check_subclass(factory, components.GrokForm)):
                 # we do not accept render and template both for a view
                 # (unless it's a form, they happen to have render.
+                import pdb; pdb.set_trace()
                 raise GrokError(
                     "Multiple possible ways to render view %r. "
                     "It has both a 'render' method as well as "



More information about the Checkins mailing list