[Checkins] SVN: Sandbox/darrylcousins/mars. Completing move of form components into mars.form

Darryl Cousins darryl at darrylcousins.net.nz
Sat Jul 21 02:52:07 EDT 2007


Log message for revision 78249:
  Completing move of form components into mars.form

Changed:
  U   Sandbox/darrylcousins/mars.layer/setup.py
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/README.txt
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/__init__.py
  U   Sandbox/darrylcousins/mars.layer/src/mars/layer/components.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/__init__.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/components.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/directive.py
  U   Sandbox/darrylcousins/mars.template/src/mars/template/meta.py
  U   Sandbox/darrylcousins/mars.view/src/mars/view/__init__.py
  U   Sandbox/darrylcousins/mars.view/src/mars/view/components.py
  U   Sandbox/darrylcousins/mars.view/src/mars/view/meta.py
  U   Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/viewlet.txt

-=-
Modified: Sandbox/darrylcousins/mars.layer/setup.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/setup.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.layer/setup.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -32,8 +32,6 @@
     install_requires = [
         'setuptools',
         'grok',
-        'z3c.form',
-        'z3c.formui',
         'z3c.layer',
         ],
 )

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/README.txt
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/README.txt	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/README.txt	2007-07-21 06:52:06 UTC (rev 78249)
@@ -29,15 +29,6 @@
 * mars.layer.IPageletLayer
   Uses z3c.layer.IPageletBrowserLayer
 
-* mars.layer.IFormLayer
-  Uses z3c.form.IFormLayer, z3c.layer.IPageletBrowserLayer
-
-* mars.layer.IDivFormLayer
-  Uses z3c.formui.IDivFormLayer, z3c.form.IFormLayer, z3c.layer.IPageletBrowserLayer
-
-* mars.layer.ITableFormLayer
-  Uses z3c.formui.ITableFormLayer, z3c.form.IFormLayer, z3c.layer.IPageletBrowserLayer
-
 Example Code
 ------------
 

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/__init__.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/__init__.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/__init__.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -2,8 +2,5 @@
 from components import (Skin, 
                         ILayer,
                         IMinimalLayer, 
-                        IPageletLayer,
-                        IFormLayer,
-                        IDivFormLayer,
-                        ITableFormLayer)
+                        IPageletLayer)
 

Modified: Sandbox/darrylcousins/mars.layer/src/mars/layer/components.py
===================================================================
--- Sandbox/darrylcousins/mars.layer/src/mars/layer/components.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.layer/src/mars/layer/components.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -1,10 +1,6 @@
-from zope.publisher.interfaces.browser import IBrowserRequest
 import zope.interface
 from z3c.layer.pagelet import IPageletBrowserLayer
 from z3c.layer.minimal import IMinimalBrowserLayer
-from z3c.form.interfaces import IFormLayer as IZ3CFormLayer
-from z3c.formui.interfaces import IDivFormLayer as IZ3CDivFormLayer
-from z3c.formui.interfaces import ITableFormLayer as IZ3CTableFormLayer
 
 class ILayer(zope.interface.Interface):
     pass
@@ -15,15 +11,6 @@
 class IPageletLayer(ILayer, IPageletBrowserLayer):
     pass
 
-class IFormLayer(ILayer, IZ3CFormLayer, IPageletBrowserLayer):
-    pass
-
-class IDivFormLayer(ILayer, IZ3CDivFormLayer, IZ3CFormLayer, IPageletBrowserLayer):
-    pass
-
-class ITableFormLayer(ILayer, IZ3CTableFormLayer, IZ3CFormLayer, IPageletBrowserLayer):
-    pass
-
 class Skin(object):
     pass
 

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/__init__.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/__init__.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/__init__.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -1,2 +1,2 @@
-from directive import macro, content_type, mode, view, field, widget
-from components import TemplateFactory, LayoutFactory, WidgetTemplateFactory
+from directive import macro, content_type
+from components import TemplateFactory, LayoutFactory

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/components.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/components.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/components.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -6,7 +6,4 @@
     pass
 
 
-class WidgetTemplateFactory(object):
-    pass
 
-

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/directive.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/directive.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/directive.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -6,12 +6,3 @@
                            ClassDirectiveContext())
 content_type = SingleTextDirective('mars.template.content_type',
                            ClassDirectiveContext())
-mode = SingleTextDirective('mars.template.mode',
-                           ClassDirectiveContext())
-view = InterfaceOrClassDirective('mars.template.view',
-                           ClassDirectiveContext())
-field = InterfaceOrClassDirective('mars.template.field',
-                           ClassDirectiveContext())
-widget = InterfaceOrClassDirective('mars.template.widget',
-                           ClassDirectiveContext())
-

Modified: Sandbox/darrylcousins/mars.template/src/mars/template/meta.py
===================================================================
--- Sandbox/darrylcousins/mars.template/src/mars/template/meta.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.template/src/mars/template/meta.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -74,49 +74,3 @@
     provides = ILayoutTemplate
 
 
-class WidgetTemplateFactoryGrokker(martian.ClassGrokker):
-    component_class = mars.template.WidgetTemplateFactory
-    provides = IPageTemplate
-
-    def grok(self, name, factory, context, module_info, templates):
-        view_context = util.determine_class_context(factory, context)
-        factory.module_info = module_info
-        factory_name = factory.__name__.lower()
-
-        # we need a path to the file containing the template
-        template_name = util.class_annotation(factory, 'grok.template',
-                                              factory_name)
-        filepath = os.path.join(os.path.dirname(module_info.path), template_name)
-        if not os.path.exists(filepath):
-            filepath = None
-            if os.path.exists(template_name):
-                filepath = template_name
-        if filepath is None:
-            raise GrokError("No template found for %s."
-                            " Please use grok.template to define path to the"
-                            " file containing the template"
-                            % (factory.__name__),
-                            factory)
-
-        provides = util.class_annotation(factory, 'grok.provides', self.provides)
-        contentType = util.class_annotation(factory,
-                                    'mars.template.content_type', 'text/html')
-        view_layer = util.class_annotation(factory, 'mars.layer.layer',
-                                       None) or module_info.getAnnotation('mars.layer.layer',
-                                       None) or IDefaultBrowserLayer
-        mode = util.class_annotation(factory, 'mars.template.mode', INPUT_MODE)
-        view = util.class_annotation(factory, 'mars.template.view', None)
-        field = util.class_annotation(factory, 'mars.template.field', None)
-        widget = util.class_annotation(factory, 'mars.template.widget', None)
-
-        factory = WidgetTemplateFactory(filepath, contentType)
-        zope.interface.directlyProvides(factory, provides)
-        #print '\nname:', mode,'context:', view_context,'factory:',\
-        #      factory, 'provides', provides, 'view:', view, 'field:', field, \
-        #      'widget:', widget, '\n'
-        zope.component.provideAdapter(factory,
-                                 adapts=(view_context, view_layer, view, field, widget),
-                                 provides=provides,
-                                 name=mode)
-        return True
-

Modified: Sandbox/darrylcousins/mars.view/src/mars/view/__init__.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/__init__.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/__init__.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -1,3 +1,3 @@
 from directive import layout
-from components import TemplateView, LayoutView, PageletView, FormView
+from components import TemplateView, LayoutView, PageletView
 

Modified: Sandbox/darrylcousins/mars.view/src/mars/view/components.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/components.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/components.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -65,7 +65,3 @@
 
     def __init__(self, context, request):
         BrowserPage.__init__(self, context, request)
-
-class FormView(object):
-    """Vanilla view to mixin with z3c.form views"""
-    zope.interface.implements(IPagelet)

Modified: Sandbox/darrylcousins/mars.view/src/mars/view/meta.py
===================================================================
--- Sandbox/darrylcousins/mars.view/src/mars/view/meta.py	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.view/src/mars/view/meta.py	2007-07-21 06:52:06 UTC (rev 78249)
@@ -2,8 +2,6 @@
 import zope.interface
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
 
-from z3c.template.template import TemplateFactory
-
 import martian
 from martian.error import GrokError
 from martian import util
@@ -108,17 +106,3 @@
                                  provides=self.provides,
                                  name=self.view_name)
 
-class FormViewGrokker(ViewGrokkerBase):
-    component_class = mars.view.FormView
-
-    def register(self, factory, module_info):
-
-        # is name defined for layout?
-        # if defined a named template is looked up
-        factory._layout_name = util.class_annotation(factory, 'mars.view.layout', '')
-
-        zope.component.provideAdapter(factory,
-                                 adapts=(self.view_context, self.view_layer),
-                                 provides=self.provides,
-                                 name=self.view_name)
-

Modified: Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/viewlet.txt
===================================================================
--- Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/viewlet.txt	2007-07-21 06:51:11 UTC (rev 78248)
+++ Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/viewlet.txt	2007-07-21 06:52:06 UTC (rev 78249)
@@ -33,7 +33,8 @@
   ...     zope.interface.implements(zope.interface.Interface)
   >>> content = Content()
 
-And a request object for ``viewing`` the viewlets.
+And a request object for ``viewing`` the viewlets. We'll create a special
+request object that implements IDefaultBrowserLayer
 
   >>> from zope.publisher.browser import TestRequest
   >>> request = TestRequest()
@@ -136,14 +137,13 @@
   <div>Second viewlet content</div>
   <div>First viewlet content</div>
 
-Provider
---------
+Tal Expression
+--------------
 
 Usually though we do not directly call on the manager but rather we insert the
-manager into a template using the ``provider`` expression. 
+manager into a template using the ``provider`` expression. The provider looks up
+the manager as a multiadapter.
 
-The manager will be looked up as a multiadapter.
-
   >>> from zope.contentprovider.interfaces import IContentProvider
   >>> print zope.component.queryMultiAdapter((content, request, view),
   ...             IContentProvider, 'mymanager')
@@ -162,3 +162,11 @@
   >>> print zope.component.queryMultiAdapter((content, request, view),
   ...             IContentProvider, 'mymanager')
   <MyManager ...>
+
+
+Cleanup
+-------
+
+  >>> import shutil
+  >>> shutil.rmtree(temp_dir)
+



More information about the Checkins mailing list