[Checkins] SVN: Sandbox/darrylcousins/mars.viewlet/s Egg ready

Darryl Cousins darryl at darrylcousins.net.nz
Fri Jul 13 05:41:03 EDT 2007


Log message for revision 77818:
  Egg ready

Changed:
  U   Sandbox/darrylcousins/mars.viewlet/setup.py
  U   Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/README.txt
  U   Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/tests/ftesting.zcml

-=-
Modified: Sandbox/darrylcousins/mars.viewlet/setup.py
===================================================================
--- Sandbox/darrylcousins/mars.viewlet/setup.py	2007-07-13 09:28:55 UTC (rev 77817)
+++ Sandbox/darrylcousins/mars.viewlet/setup.py	2007-07-13 09:41:02 UTC (rev 77818)
@@ -11,11 +11,8 @@
     author_email='darryl.cousins at tfws.org.nz',
     url='http://www.tfws.org.nz/mars',
     description="""\
-Martian is a library that allows the embedding of configuration
-information in Python code. Martian can then grok the system and
-do the appropriate configuration registrations.
-
-This package uses martian to register viewlets.""",
+This package uses ``martian`` and ``grok`` to register layers and skin
+for applications built on the ``zope`` framework.""",
     long_description=(
         read('src/mars/viewlet/README.txt')
         ),
@@ -26,71 +23,27 @@
     license='ZPL',
     dependency_links = ['http://download.zope.org/distribution'],
     extras_require = dict(
-        test = ['zope.app.appsetup',
-               'zope.app.authentication',
-               'zope.app.component',
-               'zope.app.container',
-               'zope.app.error',
-               'zope.app.form',
-               'zope.app.publisher',
-               'zope.app.publication',
-               'zope.app.security',
-               'zope.app.securitypolicy',
-               'zope.app.twisted',
-               'zope.app.wsgi',
-               'zope.contentprovider',
-               'zope.app.intid',
-                'z3c.formdemo',
-                'z3c.etestbrowser',
-                'zope.app.zcmlfiles',
-                'zope.app.testing',
-                'mars.template'],
-        ),
+                test=['zope.app.testing',
+                      'zope.testbrowser',
+                      'zope.app.zcmlfiles',
+                      'zope.app.securitypolicy',
+                      'zope.app.authentication',
+                      'mars.layer',
+                      'mars.template',
+                      'mars.view',
+        ]
+                ),
     install_requires = [
         'setuptools',
-        'simplejson',
-        'grok',
-        'martian',
-        'lxml',
-        'pytz',
-        'ZODB3',
-        'z3c.csvvocabulary',
-        'z3c.form',
-        'z3c.formui',
-        'z3c.layer',
-        'z3c.pagelet',
-        'z3c.template',
-        'z3c.viewlet',
-        'z3c.zrtresource',
-        'z3c.formdemo',
-        'zc.resourcelibrary',
-        'zc.table',
-        'zope.annotation',
-                      'zope.contentprovider',
-                      'zope.app.catalog',
-                      'zope.app.folder',
-        'zope.app.container',
-        'zope.app.pagetemplate',
-        'zope.app.session',
+        'zope.app.intid',
+        'zope.app.catalog',
         'zope.component',
         'zope.interface',
-        'zope.location',
-        'zope.pagetemplate',
         'zope.publisher',
-        'zope.rdb',
-        'zope.schema',
-        'zope.traversing',
+        'zope.contentprovider',
         'zope.viewlet',
+        'grok',
+        'martian',
+        'z3c.viewlet',
         ],
 )
-        #              'zope.app.pagetemplate',
-        #              'zope.app.testing',
-        #              'zope.configuration',
-        #              'zope.dottedname',
-        #              'zope.event',
-        #              'zope.formlib',
-        #              'zope.lifecycleevent',
-        #              'zope.security',
-        #              'zope.testing',
-
-

Modified: Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/README.txt
===================================================================
--- Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/README.txt	2007-07-13 09:28:55 UTC (rev 77817)
+++ Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/README.txt	2007-07-13 09:41:02 UTC (rev 77818)
@@ -1,26 +1,108 @@
-==========
-Mars Macro
-==========
+============
+Mars Viewlet
+============
 
-Martian is a library that allows the embedding of configuration
-information in Python code. Martian can then grok the system and
-do the appropriate configuration registrations.
+Introduction
+------------
 
-z3c packages bring significant clarity and a pattern for forms, view and
-templates.
+`Grok`_ is a project which seeks to provide convention over configuration.
 
+``Martian`` grew from `Grok`_:
+
+Martian is a library that allows the embedding of configuration information in
+Python code. Martian can then grok the system and do the appropriate
+configuration registrations.
+
+.. _Grok: http://grok.zope.org/
+
+Mars Viewlet
+------------
+
 This package uses martian to configure viewlets and viewletmanagers.
 
 Example Code
 ------------
 
-Please see ./tests/viewlet.py
+::
 
-Directives
-----------
+ ### the page that we are looking at
+ class Index(mars.view.LayoutView):
+     pass
 
-Please see ``directive.txt``.
+ ### the template for index page
+ class IndexLayout(mars.template.LayoutFactory):
+     grok.template('index.pt') # required
+     grok.context(Index) # required
 
+ ### a manager registered for Mammoth and IModuleLayer
+ class RightColumn(mars.viewlet.ViewletManager):
+
+     def render(self):
+         return u'Right column content'
+
+ ### a second manager registered for Mammoth and IModuleLayer
+ class LeftColumn(mars.viewlet.ViewletManager):
+     """Joins output of viewlets"""
+     pass
+
+ ### viewlets for leftcolumn manager
+ class FirstViewlet(mars.viewlet.Viewlet):
+     """A simple viewlet"""
+     grok.context(Mammoth)
+     mars.viewlet.manager(LeftColumn)
+     mars.viewlet.view(Index) # not required
+     weight = 0
+
+     def render(self):
+         return u'<div>First viewlet content</div>'
+
+ ### the second of which uses a template
+ class SecondViewlet(mars.viewlet.Viewlet):
+     """A viewlet that has its own template"""
+     grok.context(Mammoth)
+     mars.viewlet.manager(LeftColumn)
+     weight = 1
+
+
+Directives specific to this package
+-----------------------------------
+
+* mars.viewlet.manager(class_or_interface):
+  The manager for which the viewlet is registered.
+  Default: IViewletManager (?)
+
+* mars.viewlet.view(class_or_interface):
+  The view for which the viewlet is registered.
+  Default: zope.publisher.interfaces.browser.IBrowserView
+
+The mars.layer directive may be used
+-----------------------------------------
+
+* mars.layer.layer(class_or_interface):
+  The layer for which the template should be available.
+  Default: zope.publisher.browser.interfaces.IDefaultBrowserLayer
+
+Relevant grok directives
+------------------------
+
+* grok.name(name):
+  Name of the view, available in url as object/@@viewname.
+  Default: factory.__name__.lower()
+
+* grok.context(class_or_interface):
+  The view for which the template should be available. Usually should be
+  defined.
+  Default: module context
+
+* grok.template(name):
+  If defined the template will be looked up as a `named adapter`. Should only be
+  defined if a template has been registered as a named adapter.
+  Default: ''
+
+* grok.provides(class_or_interface):
+  Interface the class is looked up as, probably wouldn't be used.
+  Default: zope.interface.Interface
+
 Tests
 -----
 

Modified: Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/tests/ftesting.zcml
===================================================================
--- Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/tests/ftesting.zcml	2007-07-13 09:28:55 UTC (rev 77817)
+++ Sandbox/darrylcousins/mars.viewlet/src/mars/viewlet/tests/ftesting.zcml	2007-07-13 09:41:02 UTC (rev 77818)
@@ -7,7 +7,6 @@
   <include package="grok" file="meta.zcml" />
   <include package="mars.template" file="meta.zcml" />
   <include package="mars.layer" file="meta.zcml" />
-  <include package="mars.macro" file="meta.zcml" />
   <include package="mars.view" file="meta.zcml" />
   <include package="mars.viewlet" file="meta.zcml" />
 



More information about the Checkins mailing list