[Checkins] SVN: grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/ Fixing and Cleaning the Componentes and Grokkers

Christian Klinger cklinger at novareto.de
Fri Jul 3 11:38:32 EDT 2009


Log message for revision 101459:
  Fixing and Cleaning the Componentes and Grokkers

Changed:
  U   grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/components.py
  U   grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/meta/views.py

-=-
Modified: grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/components.py
===================================================================
--- grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/components.py	2009-07-03 15:33:10 UTC (rev 101458)
+++ grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/components.py	2009-07-03 15:38:32 UTC (rev 101459)
@@ -44,7 +44,6 @@
     def redirect(self, url):
         return self.request.response.redirect(url)
 
-
     def url(self, obj=None, name=None, data=None):
         """Return string for the URL based on the obj and name. The data
         argument is used to form a CGI query string.
@@ -74,21 +73,10 @@
 
 
 class CodeView(BaseView):
-    interface.implements(interfaces.IGrokView)
 
     def __init__(self, context, request):
         super(CodeView, self).__init__(context, request)
 
-    def default_namespace(self):
-        namespace = {}
-        namespace['context'] = self.context
-        namespace['request'] = self.request
-        namespace['view'] = self
-        return namespace
-
-    def namespace(self):
-        return {}
-
     def __call__(self):
         mapply(self.update, (), self.request)
         if self.request.response.getStatus() in (302, 303):
@@ -96,14 +84,10 @@
             # continue rendering the template or doing anything else.
             return
 
-        template = getattr(self, 'template', None)
-        if template is not None:
-            return self._render_template()
         return mapply(self.render, (), self.request)
 
 
 class View(BaseView):
-    interface.implements(interfaces.IGrokView)
 
     def __init__(self, context, request):
         super(View, self).__init__(context, request)
@@ -117,7 +101,6 @@
         else:
             self.static = None
 
-
     # Might be moved to BaseView currently only needed for PageTemplates CHECKTHIS
     @property
     def response(self):
@@ -130,12 +113,6 @@
             # continue rendering the template or doing anything else.
             return
 
-        template = getattr(self, 'template', None)
-        if template is not None:
-            return self._render_template()
-        return mapply(self.render, (), self.request)
-
-    def _render_template(self):
         return self.template.render(self)
 
     def default_namespace(self):

Modified: grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/meta/views.py
===================================================================
--- grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/meta/views.py	2009-07-03 15:33:10 UTC (rev 101458)
+++ grokcore.view/branches/reinout-christian-codeview/src/grokcore/view/meta/views.py	2009-07-03 15:38:32 UTC (rev 101459)
@@ -53,13 +53,11 @@
 
         # find templates
         templates = factory.module_info.getAnnotation('grok.templates', None)
-        if templates is not None:
-            config.action(
-                discriminator=None,
-                callable=self.checkTemplates,
-                #callable=templates.checkTemplates(factory.module_info, factory, 'view', False, True),
-                args=(templates, factory.module_info, factory)
-                )
+        config.action(
+            discriminator=None,
+            callable=self.checkTemplates,
+            args=(templates, factory.module_info, factory)
+            )
 
         # safety belt: make sure that the programmer didn't use
         # @grok.require on any of the view's methods.
@@ -82,6 +80,9 @@
             )
         return True
 
+
+    # CHECK THIS.  There is no template/render checking anymore, so this is a bit
+    # elaborate.
     def checkTemplates(self, templates, module_info, factory):
 
         def has_render(factory):



More information about the Checkins mailing list