[Checkins] SVN: megrok.layout/trunk/ First Import

Souheil CHELFOUH souheil at chelfouh.com
Mon Oct 18 05:57:17 EDT 2010


Log message for revision 117640:
  First Import

Changed:
  A   megrok.layout/trunk/README.txt
  A   megrok.layout/trunk/bootstrap.py
  A   megrok.layout/trunk/buildout.cfg
  A   megrok.layout/trunk/docs/
  A   megrok.layout/trunk/docs/HISTORY.txt
  A   megrok.layout/trunk/setup.py
  A   megrok.layout/trunk/src/
  A   megrok.layout/trunk/src/megrok/
  A   megrok.layout/trunk/src/megrok/__init__.py
  A   megrok.layout/trunk/src/megrok/__init__.pyc
  A   megrok.layout/trunk/src/megrok/layout/
  A   megrok.layout/trunk/src/megrok/layout/CREDITS.txt
  A   megrok.layout/trunk/src/megrok/layout/README.txt
  A   megrok.layout/trunk/src/megrok/layout/__init__.py
  A   megrok.layout/trunk/src/megrok/layout/__init__.pyc
  A   megrok.layout/trunk/src/megrok/layout/components.py
  A   megrok.layout/trunk/src/megrok/layout/components.pyc
  A   megrok.layout/trunk/src/megrok/layout/ftesting.zcml
  A   megrok.layout/trunk/src/megrok/layout/ftests/
  A   megrok.layout/trunk/src/megrok/layout/ftests/__init__.py
  A   megrok.layout/trunk/src/megrok/layout/ftests/__init__.pyc
  A   megrok.layout/trunk/src/megrok/layout/ftests/static/
  A   megrok.layout/trunk/src/megrok/layout/ftests/static/empty.js
  A   megrok.layout/trunk/src/megrok/layout/ftests/templates/
  A   megrok.layout/trunk/src/megrok/layout/ftests/templates/master.pt
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_general.py
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_general.pyc
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_layout.py
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_layout.pyc
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_layoutlayers.py
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_layoutlayers.pyc
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_page.py
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_page.pyc
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_static.py
  A   megrok.layout/trunk/src/megrok/layout/ftests/test_static.pyc
  A   megrok.layout/trunk/src/megrok/layout/interfaces.py
  A   megrok.layout/trunk/src/megrok/layout/interfaces.pyc
  A   megrok.layout/trunk/src/megrok/layout/meta.py
  A   megrok.layout/trunk/src/megrok/layout/meta.pyc
  A   megrok.layout/trunk/src/megrok/layout/meta.zcml
  A   megrok.layout/trunk/src/megrok/layout/testing.py
  A   megrok.layout/trunk/src/megrok/layout/testing.pyc
  A   megrok.layout/trunk/src/megrok/layout/tests/
  A   megrok.layout/trunk/src/megrok/layout/tests/__init__.py
  A   megrok.layout/trunk/src/megrok/layout/tests/__init__.pyc
  A   megrok.layout/trunk/src/megrok/layout/tests/test_renderortemplate.py
  A   megrok.layout/trunk/src/megrok/layout/tests/test_renderortemplate.pyc
  A   megrok.layout/trunk/src/megrok/layout/tests/test_samecontext.py
  A   megrok.layout/trunk/src/megrok/layout/tests/test_samecontext.pyc
  A   megrok.layout/trunk/versions.cfg

-=-
Added: megrok.layout/trunk/README.txt
===================================================================
--- megrok.layout/trunk/README.txt	                        (rev 0)
+++ megrok.layout/trunk/README.txt	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,115 @@
+=============
+megrok.layout
+=============
+
+The `megrok.layout` package provides a simple way to write view
+components which can be included into a defined layout. It turns
+around two main components : the Page and the Layout.
+
+
+Getting started
+---------------
+
+First we grok this package's grokkers::
+
+  >>> from megrok.layout import testing
+  >>> import grokcore.component as grok
+  >>> from grokcore.component.testing import grok_component
+  >>> testing.grok('megrok.layout')
+
+
+
+Layout
+------
+
+The layout is a component allowing you to design your site. Often,
+it's the common structure shared between all the pages. Technically,
+it is a class based on the view components interface, providing a
+'render' and 'update' method.
+
+Let's implement a simple Layout:
+
+  >>> from megrok.layout import Layout
+  >>> from zope.interface import Interface
+
+  >>> class MyLayout(Layout):
+  ...     grok.name('mylayout')
+  ...     grok.context(Interface)
+  ...
+  ...     def render(self):
+  ...         return u"a simple layout"
+
+We grok our component:
+
+  >>> grok_component('MyLayout', MyLayout)
+  True
+
+We check it has been correctly registered:
+
+  >>> from megrok.layout import ILayout
+  >>> from zope.component import getMultiAdapter
+  >>> from zope.publisher.browser import TestRequest
+
+  >>> layout = getMultiAdapter((Interface, TestRequest()), ILayout)
+  >>> isinstance(layout, MyLayout)
+  True
+  >>> layout.render()
+  u'a simple layout'
+
+Now let's see how to use this Layout in a specific context using a Page.
+
+
+Page
+----
+
+The page is the specific code that you want to control. It is based on
+the grokcore.View browser page implementation and therefore provides a
+'render' and 'update' method. The 'render' method will simply return the
+specific HTML code generated by the template or the 'render' method
+code while '__call__' will lookup for a Layout component and renders
+itself inside it.
+
+First, we'll create 2 models that will serve as exemples.
+
+  >>> class Aurochs(grok.Context):
+  ...    description = u'Looks like a bull'
+
+  >>> class Mammoth(grok.Context):
+  ...    description = u'Looks like an elephant'
+
+Let's create now a page that will display their description.
+
+  >>> from megrok.layout import Page
+  >>> class AnimalDisplay(Page):
+  ...    grok.name('display')
+  ... 	 grok.context(Interface)
+  ...
+  ...    def render(self):
+  ...        return self.context.description
+
+Grokking our Page will let us use it.
+
+  >>> grok_component('AnimalDisplay', AnimalDisplay)
+  True
+  >>> wooly = Mammoth()
+  >>> page = getMultiAdapter((wooly, TestRequest()), name='display')
+  >>> page.render()
+  u'Looks like an elephant'
+  >>> page()
+  u'a simple layout'
+
+As we can see, the page us using the layout, on the __call__ to
+render. Of course, this example Layout doesn't provide any
+interesting feature. Let's create something more interesting.
+
+  >>> class MammothLayout(Layout):
+  ...     grok.context(Mammoth)
+  ...
+  ...	  def render(self):
+  ...	      return u'Header. Page: %s. Footer' % self.view.render()
+
+  >>> grok_component('MammothLayout', MammothLayout)
+  True
+  >>> page()
+  u'Header. Page: Looks like an elephant. Footer'
+  

Added: megrok.layout/trunk/bootstrap.py
===================================================================
--- megrok.layout/trunk/bootstrap.py	                        (rev 0)
+++ megrok.layout/trunk/bootstrap.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,77 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap a buildout-based project
+
+Simply run this script in a directory containing a buildout.cfg.
+The script accepts buildout command-line options, so you can
+use the -c option to specify an alternate configuration file.
+
+$Id: bootstrap.py 90478 2008-08-27 22:44:46Z georgyberdyshev $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+is_jython = sys.platform.startswith('java')
+
+try:
+    import pkg_resources
+except ImportError:
+    ez = {}
+    exec urllib2.urlopen('http://peak.telecommunity.com/dist/ez_setup.py'
+                         ).read() in ez
+    ez['use_setuptools'](to_dir=tmpeggs, download_delay=0)
+
+    import pkg_resources
+
+if sys.platform == 'win32':
+    def quote(c):
+        if ' ' in c:
+            return '"%s"' % c # work around spawn lamosity on windows
+        else:
+            return c
+else:
+    def quote (c):
+        return c
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+ws  = pkg_resources.working_set
+
+if is_jython:
+    import subprocess
+    
+    assert subprocess.Popen([sys.executable] + ['-c', quote(cmd), '-mqNxd', 
+           quote(tmpeggs), 'zc.buildout'], 
+           env=dict(os.environ,
+               PYTHONPATH=
+               ws.find(pkg_resources.Requirement.parse('setuptools')).location
+               ),
+           ).wait() == 0
+
+else:
+    assert os.spawnle(
+        os.P_WAIT, sys.executable, quote (sys.executable),
+        '-c', quote (cmd), '-mqNxd', quote (tmpeggs), 'zc.buildout',
+        dict(os.environ,
+            PYTHONPATH=
+            ws.find(pkg_resources.Requirement.parse('setuptools')).location
+            ),
+        ) == 0
+
+ws.add_entry(tmpeggs)
+ws.require('zc.buildout')
+import zc.buildout.buildout
+zc.buildout.buildout.main(sys.argv[1:] + ['bootstrap'])
+shutil.rmtree(tmpeggs)

Added: megrok.layout/trunk/buildout.cfg
===================================================================
--- megrok.layout/trunk/buildout.cfg	                        (rev 0)
+++ megrok.layout/trunk/buildout.cfg	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,16 @@
+[buildout]                                                                                                                  
+develop = .
+parts = interpreter test
+extends = versions.cfg
+versions = versions
+
+[interpreter]
+recipe = zc.recipe.egg
+eggs = megrok.layout
+interpreter = python
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = megrok.layout
+defaults = ['--tests-pattern', '^f?tests$', '-v', '--package=megrok.layout']
+

Added: megrok.layout/trunk/docs/HISTORY.txt
===================================================================
--- megrok.layout/trunk/docs/HISTORY.txt	                        (rev 0)
+++ megrok.layout/trunk/docs/HISTORY.txt	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,14 @@
+Changelog
+=========
+
+0.5.1 (2009-07-24)
+------------------
+
+- add the CHANGES.txt
+  [cklinger]
+
+0.5 (2009-07-24)
+----------------
+
+- remove the grok dependency 
+  [cklinger souheil]

Added: megrok.layout/trunk/setup.py
===================================================================
--- megrok.layout/trunk/setup.py	                        (rev 0)
+++ megrok.layout/trunk/setup.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,41 @@
+from setuptools import setup, find_packages
+import os
+
+long_description = open('README.txt').read() +
+                    '\n\n' +
+                    open(os.path.join('docs', 'HISTORY.txt').read())
+
+
+
+setup(name='megrok.layout',
+      version='0.5.1',
+      description="A layout component package for zope3 and Grok.",
+      long_description = long_description,
+      classifiers=[
+          "Framework :: Zope3",
+          "Programming Language :: Python",
+          "Programming Language :: Zope",
+          "Intended Audience :: Developers",
+          "Development Status :: 4 - Beta",
+          "Topic :: Software Development :: Libraries :: Python Modules",
+          ],
+      keywords='grok layout zope3 pagelet theming',
+      author='Souheil Chelfouh',
+      author_email='trollfot at gmail.com',
+      url='http://pypi.python.org/pypi/megrok.layout',
+      license='GPL',
+      packages=find_packages('src', exclude=['ez_setup']),
+      package_dir={'': 'src'},
+      namespace_packages=['megrok'],
+      include_package_data=True,
+      zip_safe=False,
+      install_requires=[
+          'setuptools',
+	  'grokcore.view',
+	  'grokcore.formlib',
+          # -*- Extra requirements: -*-
+      ],
+      entry_points="""
+      # -*- Entry points: -*-
+      """,
+      )

Added: megrok.layout/trunk/src/megrok/__init__.py
===================================================================
--- megrok.layout/trunk/src/megrok/__init__.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/__init__.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)

Added: megrok.layout/trunk/src/megrok/__init__.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/__init__.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/__init__.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,5 @@
+³ò
+‹ÉDJc           @   sP   y e  d  ƒ i e ƒ Wn2 e j
+ o& d d k l Z e e e ƒ Z n Xd S(   t
+   pkg_resourcesiÿÿÿÿ(   t   extend_pathN(   t
+   __import__t   declare_namespacet   __name__t   ImportErrort   pkgutilR   t   __path__(    (    (    s7   /Users/cklinger/megrok/megrok.layout/megrok/__init__.pys   <module>   s   
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/CREDITS.txt
===================================================================
--- megrok.layout/trunk/src/megrok/layout/CREDITS.txt	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/CREDITS.txt	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,29 @@
+=======
+Credits
+=======
+
+Authors
+-------
+
+  - Sylvain Viollon <info at infrae com>
+
+  - Christian Klinger <cklinger at novareto.de>
+
+  - Souheil Chelfouh <trollfot at gmail.com>
+
+
+Sponsors
+--------
+
+This package has been sponsorised by NPAI for the Postaleo project and
+Infrae for the Silva project. Endorsed by the Dolmen project.
+
+  - http://www.npai.fr
+
+  - http://www.postaleo.net
+
+  - http://www.infrae.com
+
+  - http://www.infrae.com/products/silva
+
+  - http://www.dolmen-project.org

Added: megrok.layout/trunk/src/megrok/layout/README.txt
===================================================================
--- megrok.layout/trunk/src/megrok/layout/README.txt	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/README.txt	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,115 @@
+=============
+megrok.layout
+=============
+
+The `megrok.layout` package provides a simple way to write view
+components which can be included into a defined layout. It turns
+around two main components : the Page and the Layout.
+
+
+Getting started
+---------------
+
+First we grok this package's grokkers::
+
+  >>> from megrok.layout import testing
+  >>> import grokcore.component as grok
+  >>> from grokcore.component.testing import grok_component
+  >>> testing.grok('megrok.layout')
+
+
+
+Layout
+------
+
+The layout is a component allowing you to design your site. Often,
+it's the common structure shared between all the pages. Technically,
+it is a class based on the view components interface, providing a
+'render' and 'update' method.
+
+Let's implement a simple Layout:
+
+  >>> from megrok.layout import Layout
+  >>> from zope.interface import Interface
+
+  >>> class MyLayout(Layout):
+  ...     grok.name('mylayout')
+  ...     grok.context(Interface)
+  ...
+  ...     def render(self):
+  ...         return u"a simple layout"
+
+We grok our component:
+
+  >>> grok_component('MyLayout', MyLayout)
+  True
+
+We check it has been correctly registered:
+
+  >>> from megrok.layout import ILayout
+  >>> from zope.component import getMultiAdapter
+  >>> from zope.publisher.browser import TestRequest
+
+  >>> layout = getMultiAdapter((Interface, TestRequest()), ILayout)
+  >>> isinstance(layout, MyLayout)
+  True
+  >>> layout.render()
+  u'a simple layout'
+
+Now let's see how to use this Layout in a specific context using a Page.
+
+
+Page
+----
+
+The page is the specific code that you want to control. It is based on
+the grokcore.View browser page implementation and therefore provides a
+'render' and 'update' method. The 'render' method will simply return the
+specific HTML code generated by the template or the 'render' method
+code while '__call__' will lookup for a Layout component and renders
+itself inside it.
+
+First, we'll create 2 models that will serve as exemples.
+
+  >>> class Aurochs(grok.Context):
+  ...    description = u'Looks like a bull'
+
+  >>> class Mammoth(grok.Context):
+  ...    description = u'Looks like an elephant'
+
+Let's create now a page that will display their description.
+
+  >>> from megrok.layout import Page
+  >>> class AnimalDisplay(Page):
+  ...    grok.name('display')
+  ... 	 grok.context(Interface)
+  ...
+  ...    def render(self):
+  ...        return self.context.description
+
+Grokking our Page will let us use it.
+
+  >>> grok_component('AnimalDisplay', AnimalDisplay)
+  True
+  >>> wooly = Mammoth()
+  >>> page = getMultiAdapter((wooly, TestRequest()), name='display')
+  >>> page.render()
+  u'Looks like an elephant'
+  >>> page()
+  u'a simple layout'
+
+As we can see, the page us using the layout, on the __call__ to
+render. Of course, this example Layout doesn't provide any
+interesting feature. Let's create something more interesting.
+
+  >>> class MammothLayout(Layout):
+  ...     grok.context(Mammoth)
+  ...
+  ...	  def render(self):
+  ...	      return u'Header. Page: %s. Footer' % self.view.render()
+
+  >>> grok_component('MammothLayout', MammothLayout)
+  True
+  >>> page()
+  u'Header. Page: Looks like an elephant. Footer'
+  

Added: megrok.layout/trunk/src/megrok/layout/__init__.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/__init__.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/__init__.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,2 @@
+from megrok.layout.interfaces import ILayout, IPage
+from megrok.layout.components import Layout, Page, Form

Added: megrok.layout/trunk/src/megrok/layout/__init__.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/__init__.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/__init__.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,2 @@
+³ò
+‹ÉDJc           @   s6   d  d k  l Z l Z d  d k l Z l Z l Z d S(   iÿÿÿÿ(   t   ILayoutt   IPage(   t   Layoutt   Paget   FormN(   t   megrok.layout.interfacesR    R   t   megrok.layout.componentsR   R   R   (    (    (    s>   /Users/cklinger/megrok/megrok.layout/megrok/layout/__init__.pys   <module>   s   
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/components.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/components.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/components.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,140 @@
+# -*- coding: utf-8 -*-
+
+import zope.component
+import grokcore.view
+import grokcore.formlib
+import grokcore.component as grok
+from zope.interface import Interface
+from zope.publisher.publish import mapply
+from megrok.layout import IPage, ILayout
+
+
+class Layout(object):
+    """A layout object.
+    """
+    grok.baseclass()
+    grok.implements(ILayout)
+
+    def __init__(self, context, request):
+        self.context = context
+        self.request = request
+        self.view = None
+
+        if getattr(self, 'module_info', None) is not None:
+            self.static = zope.component.queryAdapter(
+                self.request, Interface,
+                name=self.module_info.package_dotted_name
+                )
+        else:
+            self.static = None
+
+    def default_namespace(self):
+        namespace = {}
+        namespace['view'] = self.view
+        namespace['layout'] = self
+        namespace['static'] = self.static
+        namespace['context'] = self.context
+        namespace['request'] = self.request
+        return namespace
+
+    def namespace(self):
+        return {}
+
+    def update(self):
+        pass
+
+    @property
+    def response(self):
+        return self.request.response
+
+    def _render_template(self):
+        return self.template.render(self)
+
+    def render(self):
+        return self._render_template()
+
+    render.base_method = True
+
+    def __call__(self, view):
+        self.view = view
+        self.update()
+        return self.render()
+
+
+class Page(grokcore.view.View):
+    """A view class.
+    """
+    grok.baseclass()
+    grok.implements(IPage)
+
+    template = None
+
+    def __init__(self, context, request):
+        super(Page, self).__init__(context, request)
+        self.layout = None
+
+    def default_namespace(self):
+        namespace = super(Page, self).default_namespace()
+        namespace['layout'] = self.layout
+        return namespace
+
+    def render(self):
+        return self._render_template()
+
+    render.base_method = True
+
+    @property
+    def content(self):
+        template = getattr(self, 'template', None)
+        if template is not None:
+            return self._render_template()
+        return mapply(self.render, (), self.request)
+
+    def __call__(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
+        self.layout = zope.component.getMultiAdapter(
+            (self.context, self.request), ILayout)
+        return self.layout(self)
+
+
+class Form(grokcore.formlib.Form):
+    """A form class.
+    """
+    grok.baseclass()
+    
+    def __init__(self, context, request):
+        super(Form, self).__init__(context, request)
+        self.layout = None
+
+    def default_namespace(self):
+        namespace = super(Form, self).default_namespace()
+        namespace['layout'] = self.layout
+        return namespace
+
+    @property
+    def content(self):
+        template = getattr(self, 'template', None)
+        if template is not None:
+            return self._render_template()
+        return mapply(self.render, (), self.request)
+    
+    def __call__(self):
+        """Calls update and returns the layout template which calls render.
+        """
+        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
+        
+        self.update_form()
+        if self.request.response.getStatus() in (302, 303):
+            return
+        
+        self.layout = zope.component.getMultiAdapter(
+            (self.context, self.request), ILayout)
+        return self.layout(self)

Added: megrok.layout/trunk/src/megrok/layout/components.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/components.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/components.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,53 @@
+³ò
+í+OJc        
+   @   s»   d  d k  Z d  d k Z d  d k Z d  d k i Z d  d k l	 Z	 d  d k
+ l Z d  d k l
+ Z
+ l Z d e f d „  ƒ  YZ d e i i f d „  ƒ  YZ d	 e i i f d
+ „  ƒ  YZ d S(   iÿÿÿÿN(   t	   Interface(   t   mapply(   t   IPaget   ILayoutt   Layoutc           B   s|   e  Z d  Z e i ƒ  e i e ƒ d „  Z d „  Z d „  Z	 d „  Z
+ e d „  ƒ Z d „  Z
+ d „  Z e e _ d „  Z RS(	   s   A layout object.
+    c         C   sl   | |  _  | |  _ d  |  _ t |  d d  ƒ d  j	 o+ t i i |  i t d |  i	 i
+ ƒ|  _ n
+ d  |  _ d  S(   Nt   module_infot   name(   t   contextt   requestt   Nonet   viewt   getattrt   zopet	   componentt   queryAdapterR    R   t   package_dotted_namet   static(   t   selfR   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyt   __init__   s    				c         C   sH   h  } |  i  | d <|  | d <|  i | d <|  i | d <|  i | d <| S(   NR
+   t   layoutR   R   R   (   R
+   R   R   R   (   R   t	   namespace(    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyt   default_namespace   s    
+
+
+
+
+c         C   s   h  S(   N(    (   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   (   s    c         C   s   d  S(   N(    (   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyt   update+   s    c         C   s
+   |  i  i S(   N(   R   t   response(   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   .   s    c         C   s   |  i  i |  ƒ S(   N(   t   templatet   render(   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyt   _render_template2   s    c         C   s
+   |  i  ƒ  S(   N(   R   (   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   5   s    c         C   s   | |  _  |  i ƒ  |  i ƒ  S(   N(   R
+   R   R   (   R   R
+   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyt   __call__:   s    	
+(   t   __name__t
+   __module__t   __doc__t   grokt	   baseclasst
+   implementsR   R   R   R   R   t   propertyR   R   R   t   Truet   base_methodR   (    (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR      s   
+
+	
+							t   Pagec           B   sg   e  Z d  Z e i ƒ  e i e ƒ d Z d „  Z	 d „  Z
+ d „  Z e e _
+ e d „  ƒ Z d „  Z RS(   s   A view class.
+    c         C   s&   t  t |  ƒ i | | ƒ d  |  _ d  S(   N(   t   superR%   R   R	   R   (   R   R   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   H   s    c         C   s&   t  t |  ƒ i ƒ  } |  i | d <| S(   NR   (   R&   R%   R   R   (   R   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   L   s    
+c         C   s
+   |  i  ƒ  S(   N(   R   (   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   Q   s    c         C   sC   t  |  d d  ƒ } | d  j	 o |  i ƒ  Sn t |  i d |  i ƒ S(   NR   (    (   R   R	   R   R   R   R   (   R   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyt   contentV   s    
+c         C   sh   t  |  i d |  i ƒ |  i i i ƒ  d j o d  Sn t i i |  i |  i f t	 ƒ |  _
+ |  i
+ |  ƒ S(   Ni.  i/  (    (   i.  i/  (   R   R   R   R   t	   getStatusR   R
+   t   getMultiAdapterR   R   R   (   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   ]   s    	N(   R   R   R   R   R    R!   R   R	   R   R   R   R   R#   R$   R"   R'   R   (    (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR%   @   s   
+
+				t   Formc           B   sB   e  Z d  Z e i ƒ  d „  Z d „  Z e d „  ƒ Z d „  Z	 RS(   s   A form class.
+    c         C   s&   t  t |  ƒ i | | ƒ d  |  _ d  S(   N(   R&   R*   R   R	   R   (   R   R   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   m   s    c         C   s&   t  t |  ƒ i ƒ  } |  i | d <| S(   NR   (   R&   R*   R   R   (   R   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   q   s    
+c         C   sC   t  |  d d  ƒ } | d  j	 o |  i ƒ  Sn t |  i d |  i ƒ S(   NR   (    (   R   R	   R   R   R   R   (   R   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR'   v   s    
+c         C   s“   t  |  i d |  i ƒ |  i i i ƒ  d j o d Sn |  i ƒ  |  i i i ƒ  d j o d Sn t i i |  i	 |  i f t
+ ƒ |  _ |  i |  ƒ S(   sI   Calls update and returns the layout template which calls render.
+        i.  i/  N(    (   i.  i/  (   i.  i/  (   R   R   R   R   R(   t   update_formR   R
+   R)   R   R   R   (   R   (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR   }   s    
+	(
+   R   R   R   R   R    R   R   R"   R'   R   (    (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pyR*   h   s   
+		(   t   zope.componentR   t
+   grokcore.viewt   grokcoret   grokcore.formlibt   grokcore.componentR
+   R   t   zope.interfaceR    t   zope.publisher.publishR   t
+   megrok.layoutR   R   t   objectR   R
+   t   ViewR%   t   formlibR*   (    (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/components.pys   <module>   s   4(
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/ftesting.zcml
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftesting.zcml	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftesting.zcml	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,42 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:grok="http://namespaces.zope.org/grok">
+
+  <include package="zope.app.zcmlfiles" file="meta.zcml" />
+  <include package="zope.securitypolicy" file="meta.zcml" />
+  <include package="megrok.layout" file="meta.zcml" />
+
+  <include package="zope.app.zcmlfiles" />
+  <include package="zope.app.authentication" />
+  <include package="grokcore.view" />
+
+  <grok:grok package="megrok.layout.ftests" />
+
+  <securityPolicy
+      component="zope.securitypolicy.zopepolicy.ZopeSecurityPolicy"
+      />
+
+  <unauthenticatedPrincipal
+      id="zope.anybody"
+      title="Unauthenticated User"
+      />
+
+  <grant
+      permission="zope.View"
+      principal="zope.anybody"
+      />
+
+  <principal
+      id="zope.mgr"
+      title="Manager"
+      login="mgr"
+      password="mgrpw"
+      />
+
+  <role id="zope.Manager" title="Site Manager" />
+  <grantAll role="zope.Manager" />
+  <grant role="zope.Manager" principal="zope.mgr" />
+
+
+
+</configure>

Added: megrok.layout/trunk/src/megrok/layout/ftests/__init__.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/__init__.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/__init__.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,9 @@
+import os.path                                                                                                               
+import megrok.layout
+from zope.app.testing.functional import ZCMLLayer
+
+ftesting_zcml = os.path.join(os.path.dirname(megrok.layout.__file__),
+                             'ftesting.zcml')
+FunctionalLayer = ZCMLLayer(ftesting_zcml, __name__, 'FunctionalLayer',
+                            allow_teardown=True)
+

Added: megrok.layout/trunk/src/megrok/layout/ftests/__init__.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/__init__.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/__init__.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,7 @@
+³ò
+‹ÉDJc        	   @   sk   d  d k  Z d  d k Z d  d k l Z e i i e i i e i	 i
+ ƒ d ƒ Z e e e d d e
+ ƒZ d S(   iÿÿÿÿN(   t	   ZCMLLayers
+   ftesting.zcmlt   FunctionalLayert   allow_teardown(   t   os.patht   ost
+   megrok.layoutt   megrokt   zope.app.testing.functionalR    t   patht   joint   dirnamet   layoutt   __file__t
+   ftesting_zcmlt   __name__t   TrueR   (    (    (    sE   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/__init__.pys   <module>   s   	
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/ftests/templates/master.pt
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/templates/master.pt	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/templates/master.pt	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,8 @@
+<html>
+ <body>
+   <div class="layout" tal:content="structure view/render">
+         here comes the content
+   </div>
+ </body>
+</html>
+

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_general.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_general.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_general.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,37 @@
+import unittest
+import doctest
+from zope.testing import cleanup
+from zope.testing import module
+import zope.component.eventtesting
+from zope import component
+from megrok import layout
+
+    
+def moduleSetUp(test):
+    module.setUp(test, '__main__')
+    
+def moduleTearDown(test):    
+    module.tearDown(test)
+    cleanup.cleanUp()
+    
+def zopeSetUp(test):
+    zope.component.eventtesting.setUp(test)
+
+def zopeTearDown(test):
+    cleanup.cleanUp()
+    
+def test_suite():
+    optionflags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
+    globs = {}
+    suite = unittest.TestSuite()
+    
+    suite.addTest(
+        doctest.DocFileSuite(
+            '../README.txt',
+            optionflags=optionflags,
+            setUp=moduleSetUp,
+            tearDown=moduleTearDown,
+            globs=globs)
+        )
+
+    return suite

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_general.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_general.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_general.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,14 @@
+³ò
+‹ÉDJc        	   @   s•   d  d k  Z  d  d k Z d  d k l Z d  d k l Z d  d k Z d  d k l Z d  d k l	 Z	 d „  Z
+ d „  Z d „  Z d	 „  Z
+ d
+ „  Z d S(   iÿÿÿÿN(   t   cleanup(   t   module(   t	   component(   t   layoutc         C   s   t  i |  d ƒ d  S(   Nt   __main__(   R   t   setUp(   t   test(    (    sI   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_general.pyt   moduleSetUp
+   s    c         C   s   t  i |  ƒ t i ƒ  d  S(   N(   R   t   tearDownR    t   cleanUp(   R   (    (    sI   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_general.pyt   moduleTearDown
+   s    
+c         C   s   t  i i i |  ƒ d  S(   N(   t   zopeR   t   eventtestingR   (   R   (    (    sI   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_general.pyt	   zopeSetUp   s    c         C   s   t  i ƒ  d  S(   N(   R    R	   (   R   (    (    sI   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_general.pyt   zopeTearDown   s    c          C   sT   t  i t  i B}  h  } t i ƒ  } | i t  i d d |  d t d t d | ƒƒ | S(   Ns
+   ../README.txtt   optionflagsR   R   t   globs(	   t   doctestt   NORMALIZE_WHITESPACEt   ELLIPSISt   unittestt	   TestSuitet   addTestt   DocFileSuiteR   R
+   (   R   R   t   suite(    (    sI   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_general.pyt
+   test_suite   s    
+(   R   R   t   zope.testingR    R   t   zope.component.eventtestingR   R   t   megrokR   R   R
+   R
+   R   R   (    (    (    sI   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_general.pys   <module>   s   				
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_layout.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_layout.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_layout.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,58 @@
+"""
+  >>> from megrok.layout import ILayout
+  >>> from zope.component import getMultiAdapter
+  >>> from zope.publisher.browser import TestRequest
+  >>> request = TestRequest()
+  >>> mammoth = Mammoth()
+  >>> mylayout = getMultiAdapter((mammoth, request), ILayout)
+  >>> ILayout.providedBy(mylayout)
+  True
+
+  >>> mylayout.context
+  <megrok.layout.ftests.test_layout.Mammoth object at ...>
+
+  >>> mylayout.render()
+  '<div> MyLayout </div>'
+
+  >>> elephant = Elephant()
+  >>> mycontextlayout = getMultiAdapter((elephant, request), ILayout)
+  >>> mycontextlayout.render()
+  '<div> MyContextLayout </div>'
+"""
+
+import grokcore.component as grok
+
+from zope import interface
+from megrok.layout import Layout 
+
+
+class Mammoth(grok.Context):
+    pass
+
+
+class Elephant(grok.Context):
+    pass
+
+
+class MyLayout(Layout):
+    grok.context(interface.Interface)
+
+    def render(self):
+	return "<div> MyLayout </div>"
+
+
+class MyContextLayout(Layout):
+    grok.context(Elephant)
+
+    def render(self):
+	return "<div> MyContextLayout </div>"
+
+
+def test_suite():
+    from zope.testing import doctest
+    from megrok.layout.ftests import FunctionalLayer
+    suite = doctest.DocTestSuite(
+        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
+        )
+    suite.layer = FunctionalLayer
+    return suite  

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_layout.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_layout.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_layout.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,33 @@
+³ò
+í+OJc           @   s    d  Z  d d k i Z d d k l Z d d k l Z d e i f d „  ƒ  YZ	 d e i f d „  ƒ  YZ
+ d	 e f d
+ „  ƒ  YZ d e f d „  ƒ  YZ d
+ „  Z
+ d S(   sX  
+  >>> from megrok.layout import ILayout
+  >>> from zope.component import getMultiAdapter
+  >>> from zope.publisher.browser import TestRequest
+  >>> request = TestRequest()
+  >>> mammoth = Mammoth()
+  >>> mylayout = getMultiAdapter((mammoth, request), ILayout)
+  >>> ILayout.providedBy(mylayout)
+  True
+
+  >>> mylayout.context
+  <megrok.layout.ftests.test_layout.Mammoth object at ...>
+
+  >>> mylayout.render()
+  '<div> MyLayout </div>'
+
+  >>> elephant = Elephant()
+  >>> mycontextlayout = getMultiAdapter((elephant, request), ILayout)
+  >>> mycontextlayout.render()
+  '<div> MyContextLayout </div>'
+iÿÿÿÿN(   t	   interface(   t   Layoutt   Mammothc           B   s   e  Z RS(    (   t   __name__t
+   __module__(    (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layout.pyR      s   t   Elephantc           B   s   e  Z RS(    (   R   R   (    (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layout.pyR   !   s   t   MyLayoutc           B   s!   e  Z e i e i ƒ d  „  Z RS(   c         C   s   d S(   Ns   <div> MyLayout </div>(    (   t   self(    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layout.pyt   render(   s    (   R   R   t   grokt   contextR    t	   InterfaceR   (    (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layout.pyR   %   s   t   MyContextLayoutc           B   s   e  Z e i e ƒ d  „  Z RS(   c         C   s   d S(   Ns   <div> MyContextLayout </div>(    (   R   (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layout.pyR   /   s    (   R 
   R   R	   R
+   R   R   (    (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layout.pyR   ,   s   
+c          C   sI   d d k  l }  d d k l } |  i d |  i |  i Bƒ } | | _ | S(   Niÿÿÿÿ(   t   doctest(   t   FunctionalLayert   optionflags(   t   zope.testingR
+   t   megrok.layout.ftestsR   t   DocTestSuitet   NORMALIZE_WHITESPACEt   ELLIPSISt   layer(   R
+   R   t   suite(    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layout.pyt
+   test_suite3   s    		(   t   __doc__t   grokcore.componentt	   componentR	   t   zopeR    t
+   megrok.layoutR   t   ContextR   R   R   R   R   (    (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layout.pys   <module>   s   
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_layoutlayers.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_layoutlayers.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_layoutlayers.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,94 @@
+"""
+  >>> from zope.app.testing.functional import getRootFolder
+  >>> getRootFolder()["a"] = A()
+  >>> getRootFolder()["b"] = B()
+  >>> from zope.testbrowser.testing import Browser
+  >>> browser = Browser()
+  >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+  >>> browser.handleErrors = False 
+  
+  >>> browser.open("http://localhost/++skin++Basic/a/@@myview") 
+  >>> print browser.contents
+  <div> A Layout </div>
+
+  >>> browser.open("http://localhost/++skin++myskin/a/@@myview") 
+  >>> print browser.contents
+  <div> A2 Layout </div>
+  
+  >>> browser.open("http://localhost/++skin++myskin/b/@@myviewb")
+  >>> print browser.contents
+  <div> B Layout </div>
+"""
+
+import grokcore.component as grok
+from grokcore.view import layer, skin
+
+from zope import interface
+from megrok.layout import Layout, Page 
+from zope.app.basicskin import IBasicSkin
+
+layer(IBasicSkin)
+
+
+class MySkinLayer(IBasicSkin):
+    pass
+
+
+class MySkin(MySkinLayer):
+    skin('myskin')
+
+
+class A(grok.Context):
+    pass
+
+
+class B(grok.Context):
+    pass
+
+
+class ALayout(Layout):
+    grok.context(A)
+
+    def render(self):
+	return "<div> A Layout </div>"
+
+
+class A2Layout(Layout):
+    grok.context(A)
+    layer(MySkinLayer)
+
+    def render(self):
+	return "<div> A2 Layout </div>"
+
+
+class BLayout(Layout):
+    grok.context(B)
+    layer(MySkinLayer)
+
+    def render(self):
+	return "<div> B Layout </div>"
+
+
+class MyView(Page):
+    grok.context(interface.Interface)
+
+    def render(self):
+        return "MYVIEW"
+
+
+class MyViewB(Page):
+    grok.context(interface.Interface)
+    layer(MySkinLayer)
+
+    def render(self):
+        return "MYVIEW"
+
+
+def test_suite():
+    from zope.testing import doctest
+    from megrok.layout.ftests import FunctionalLayer
+    suite = doctest.DocTestSuite(
+        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
+        )
+    suite.layer = FunctionalLayer
+    return suite  

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_layoutlayers.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_layoutlayers.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_layoutlayers.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,47 @@
+³ò
+§|iJc           @   sD  d  Z  d d k i Z d d k l Z l Z d d k l Z d d k	 l
+ Z
+ l Z d d k l
+ Z
+ e e
+ ƒ d e
+ f d „  ƒ  YZ d	 e f d
+ „  ƒ  YZ d e i f d „  ƒ  YZ d
+ e i f d „  ƒ  YZ d e
+ f d „  ƒ  YZ d e
+ f d „  ƒ  YZ d e
+ f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z d S(   s˜  
+  >>> from zope.app.testing.functional import getRootFolder
+  >>> getRootFolder()["a"] = A()
+  >>> getRootFolder()["b"] = B()
+  >>> from zope.testbrowser.testing import Browser
+  >>> browser = Browser()
+  >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+  >>> browser.handleErrors = False 
+  
+  >>> browser.open("http://localhost/++skin++Basic/a/@@myview") 
+  >>> print browser.contents
+  <div> A Layout </div>
+
+  >>> browser.open("http://localhost/++skin++myskin/a/@@myview") 
+  >>> print browser.contents
+  <div> A2 Layout </div>
+  
+  >>> browser.open("http://localhost/++skin++myskin/b/@@myviewb")
+  >>> print browser.contents
+  <div> B Layout </div>
+iÿÿÿÿN(   t   layert   skin(   t	   interface(   t   Layoutt   Page(   t
+   IBasicSkint   MySkinLayerc           B   s   e  Z RS(    (   t   __name__t
+   __module__(    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   !   s   t   MySkinc           B   s   e  Z e d  ƒ RS(   t   myskin(   R   R   R   (    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR	   %   s   t   Ac           B   s   e  Z RS(    (   R   R   (    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   )   s   t   Bc           B   s   e  Z RS(    (   R   R   (    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   -   s   t   ALayoutc           B   s   e  Z e i e ƒ d  „  Z RS(   c         C   s   d S(   Ns   <div> A Layout </div>(    (   t   self(    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyt   render4   s    (   R   R   t   grokt   contextR   R   (    (    (   
  sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR
+   1   s   
+t   A2Layoutc           B   s(   e  Z e i e ƒ e e ƒ d  „  Z RS(   c         C   s   d S(   Ns   <div> A2 Layout </div>(    (   R   (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   <   s    (   R   R   R   R   R   R    R   R   (    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   8   s   
+
+t   BLayoutc           B   s(   e  Z e i e ƒ e e ƒ d  „  Z RS(   c         C   s   d S(   Ns   <div> B Layout </div>(    (   R   (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   D   s    (   R   R   R   R   R   R    R   R   (    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   @   s   
+
+t   MyViewc           B   s!   e  Z e i e i ƒ d  „  Z RS(   c         C   s   d S(   Nt   MYVIEW(    (   R   (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   K   s    (   R   R   R   R   R   t	   InterfaceR   (    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   H   s   t   MyViewBc           B   s+   e  Z e i e i ƒ e e ƒ d  „  Z RS(   c         C   s   d S(   NR   (    (   R   (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   S   s    (	   R   R   R   R   R   R   R    R   R   (    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyR   O   s   
+c          C   sI   d d k  l }  d d k l } |  i d |  i |  i Bƒ } | | _ | S(   Niÿÿÿÿ(   t   doctest(   t   FunctionalLayert   optionflags(   t   zope.testingR   t   megrok.layout.ftestsR   t   DocTestSuitet   NORMALIZE_WHITESPACEt   ELLIPSISR    (   R   R   t   suite(    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pyt
+   test_suiteW   s    		(   t   __doc__t   grokcore.componentt	   componentR   t
+   grokcore.viewR    R   t   zopeR   t
+   megrok.layoutR   R   t   zope.app.basicskinR   R   R	   t   ContextR   R   R
+   R   R   R   R   R!   (    (    (    sN   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_layoutlayers.pys   <module>   s    
+
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_page.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_page.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_page.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,59 @@
+"""
+  >>> from megrok.layout import ILayout
+  >>> from zope.component import getMultiAdapter
+  >>> from zope.publisher.browser import TestRequest
+  >>> request = TestRequest()
+  >>> cow = Cow()
+  >>> mylayout = getMultiAdapter((cow, request), ILayout)
+  >>> myview = getMultiAdapter((cow, request), name='myview')
+
+
+  >>> print myview()
+  <html>
+   <body>
+     <div class="layout"><p> My nice Content </p></div>
+   </body>
+  </html>
+
+ 
+  >>> myview
+  <megrok.layout.ftests.test_page.MyView object at ...>
+  >>> myview.layout
+  <megrok.layout.ftests.test_page.Master object at ...>
+  >>> print myview.content
+  <p> My nice Content </p>
+
+"""
+import grokcore.component as grok
+from grokcore.view import templatedir
+
+from zope import interface
+from megrok.layout import Layout, Page
+
+templatedir('templates')
+
+
+class Cow(grok.Context):
+    pass
+
+
+class Master(Layout):
+    grok.name('master')
+    grok.context(Cow)
+
+
+class MyView(Page):
+    grok.context(interface.Interface)
+
+    def render(self):
+	return "<p> My nice Content </p>"
+
+
+def test_suite():
+    from zope.testing import doctest
+    from megrok.layout.ftests import FunctionalLayer
+    suite = doctest.DocTestSuite(
+        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
+        )
+    suite.layer = FunctionalLayer
+    return suite  

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_page.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_page.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_page.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,43 @@
+³ò
+n)OJc           @   s§   d  Z  d d k i Z d d k l Z d d k l Z d d k l	 Z	 l
+ Z
+ e d ƒ d e i f d „  ƒ  YZ d	 e	 f d
+ „  ƒ  YZ
+ d e
+ f d „  ƒ  YZ d
+ „  Z d S(   sy  
+  >>> from megrok.layout import ILayout
+  >>> from zope.component import getMultiAdapter
+  >>> from zope.publisher.browser import TestRequest
+  >>> request = TestRequest()
+  >>> cow = Cow()
+  >>> mylayout = getMultiAdapter((cow, request), ILayout)
+  >>> myview = getMultiAdapter((cow, request), name='myview')
+
+
+  >>> print myview()
+  <html>
+   <body>
+     <div class="layout"><p> My nice Content </p></div>
+   </body>
+  </html>
+
+ 
+  >>> myview
+  <megrok.layout.ftests.test_page.MyView object at ...>
+  >>> myview.layout
+  <megrok.layout.ftests.test_page.Master object at ...>
+  >>> print myview.content
+  <p> My nice Content </p>
+
+iÿÿÿÿN(   t   templatedir(   t	   interface(   t   Layoutt   Paget	   templatest   Cowc           B   s   e  Z RS(    (   t   __name__t
+   __module__(    (    (    sF   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_page.pyR   $   s   t   Masterc           B   s"   e  Z e i d  ƒ e i e ƒ RS(   t   master(   R   R   t   grokt   namet   contextR   (    (    (    sF   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_page.pyR   (   s   
+t   MyViewc           B   s!   e  Z e i e i ƒ d  „  Z RS(   c         C   s   d S(   Ns   <p> My nice Content </p>(    (   t   self(    (    sF   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_page.pyt   render0   s    (   R   R   R
+   R   R   t	   InterfaceR   (    (    (    sF   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_page.pyR
+   -   s   c          C   sI   d d k  l }  d d k l } |  i d |  i |  i Bƒ } | | _ | S(   Niÿÿÿÿ(   t   doctest(   t   FunctionalLayert   optionflags(   t   zope.testingR   t   megrok.layout.ftestsR   t   DocTestSuitet   NORMALIZE_WHITESPACEt   ELLIPSISt   layer(   R   R   t   suite(    (    sF   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_page.pyt
+   test_suite4   s    		(   t   __doc__t   grokcore.componentt	   componentR
+   t
+   grokcore.viewR    t   zopeR   t
+   megrok.layoutR   R   t   ContextR   R   R
+   R   (    (    (    sF   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_page.pys   <module>   s   
+
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_static.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_static.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_static.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,33 @@
+"""
+  >>> from megrok.layout import ILayout
+  >>> from zope.component import getMultiAdapter
+  >>> from zope.publisher.browser import TestRequest
+  >>> request = TestRequest()
+  >>> mongo = Dummy()
+  >>> mylayout = getMultiAdapter((mongo, request), ILayout)
+  >>> mylayout.static
+  <grokcore.view.components.DirectoryResource object at ...>
+  >>> mylayout.static['empty.js']
+  <zope.app.publisher.browser.fileresource.FileResource object at ...>
+"""
+
+import grokcore.component as grok
+from megrok.layout import Layout
+
+
+class Dummy(grok.Context):
+    pass
+
+
+class LayoutWithResources(Layout):
+    pass
+
+
+def test_suite():
+    from zope.testing import doctest
+    from megrok.layout.ftests import FunctionalLayer
+    suite = doctest.DocTestSuite(
+        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
+        )
+    suite.layer = FunctionalLayer
+    return suite  

Added: megrok.layout/trunk/src/megrok/layout/ftests/test_static.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/ftests/test_static.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/ftests/test_static.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,18 @@
+³ò
+n)OJc           @   sa   d  Z  d d k i Z d d k l Z d e i f d „  ƒ  YZ d e f d „  ƒ  YZ d „  Z	 d S(	   s»  
+  >>> from megrok.layout import ILayout
+  >>> from zope.component import getMultiAdapter
+  >>> from zope.publisher.browser import TestRequest
+  >>> request = TestRequest()
+  >>> mongo = Dummy()
+  >>> mylayout = getMultiAdapter((mongo, request), ILayout)
+  >>> mylayout.static
+  <grokcore.view.components.DirectoryResource object at ...>
+  >>> mylayout.static['empty.js']
+  <zope.app.publisher.browser.fileresource.FileResource object at ...>
+iÿÿÿÿN(   t   Layoutt   Dummyc           B   s   e  Z RS(    (   t   __name__t
+   __module__(    (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_static.pyR      s   t   LayoutWithResourcesc           B   s   e  Z RS(    (   R   R   (    (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_static.pyR      s   c          C   sI   d d k  l }  d d k l } |  i d |  i |  i Bƒ } | | _ | S(   Niÿÿÿÿ(   t   doctest(   t   FunctionalLayert   optionflags(   t   zope.testingR   t   megrok.layout.ftestsR   t   DocTestSuitet   NORMALIZE_WHITESPACEt   ELLIPSISt   layer(   R   R   t   suite(    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_static.pyt
+   test_suite   s    		(
+   t   __doc__t   grokcore.componentt	   componentt   grokt
+   megrok.layoutR    t   ContextR   R   R   (    (    (    sH   /Users/cklinger/megrok/megrok.layout/megrok/layout/ftests/test_static.pys   <module>   s
+   
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/interfaces.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/interfaces.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/interfaces.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+
+from zope.interface import Interface
+
+
+class ILayout(Interface):
+    """Layout code.
+    """
+
+class IPage(Interface):
+    """A template using a layout to render itself.
+    """

Added: megrok.layout/trunk/src/megrok/layout/interfaces.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/interfaces.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/interfaces.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,6 @@
+³ò
+‹ÉDJc           @   s@   d  d k  l Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d S(   iÿÿÿÿ(   t	   Interfacet   ILayoutc           B   s   e  Z d  Z RS(   s   Layout code.
+    (   t   __name__t
+   __module__t   __doc__(    (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/interfaces.pyR      s   t   IPagec           B   s   e  Z d  Z RS(   s0   A template using a layout to render itself.
+    (   R   R   R   (    (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/interfaces.pyR   
+   s   N(   t   zope.interfaceR    R   R   (    (    (    s@   /Users/cklinger/megrok/megrok.layout/megrok/layout/interfaces.pys   <module>   s   
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/meta.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/meta.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/meta.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+
+import martian
+import zope.component
+import grokcore.component
+from megrok.layout import ILayout, Layout
+from zope.publisher.interfaces.browser import IDefaultBrowserLayer
+
+
+class LayoutGrokker(martian.ClassGrokker):
+
+    martian.component(Layout)
+    martian.directive(grokcore.component.context)
+    martian.directive(grokcore.view.layer, default=IDefaultBrowserLayer)
+
+    def grok(self, name, factory, module_info, **kw):
+        factory.module_info = module_info
+        return super(LayoutGrokker, self).grok(name, factory, module_info, **kw)
+
+    def execute(self, factory, config, context, layer, **kw):
+        # find templates
+        templates = factory.module_info.getAnnotation('grok.templates', None)
+        if templates is not None:
+            config.action(
+                discriminator=None,
+                callable=self.checkTemplates,
+                args=(templates, factory.module_info, factory)
+                )
+
+        adapts = (context, layer)
+        config.action(
+            discriminator=('adapter', adapts, ILayout),
+            callable=zope.component.provideAdapter,
+            args=(factory, adapts, ILayout),
+            )
+        return True
+
+    def checkTemplates(self, templates, module_info, factory):
+
+        def has_render(factory):
+            render = getattr(factory, 'render', None)
+            base_method = getattr(render, 'base_method', False)
+            return render and not base_method
+
+        def has_no_render(factory):
+            return not getattr(factory, 'render', None)
+        templates.checkTemplates(module_info, factory, 'view',
+                                 has_render, has_no_render)

Added: megrok.layout/trunk/src/megrok/layout/meta.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/meta.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/meta.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,21 @@
+³ò
+‹ÉDJc           @   sg   d  d k  Z  d  d k Z d  d k Z d  d k l Z l Z d  d k l	 Z	 d e  i
+ f d „  ƒ  YZ d S(   iÿÿÿÿN(   t   ILayoutt   Layout(   t   IDefaultBrowserLayert
+   LayoutGrokkerc           B   s\   e  Z e i e ƒ e i e i i ƒ e i e i i	 d  e
+ ƒd „  Z d „  Z d „  Z
+ RS(   t   defaultc         K   s(   | | _  t t |  ƒ i | | | |  S(   N(   t   module_infot   superR   t   grok(   t   selft   namet   factoryR   t   kw(    (    s:   /Users/cklinger/megrok/megrok.layout/megrok/layout/meta.pyR      s    	c      	   K   s•   | i  i d d  ƒ } | d  j	 o/ | i d d  d |  i d | | i  | f ƒ n | | f } | i d d | t f d t i i d | | t f ƒ t	 S(   Ns   grok.templatest
+   discriminatort   callablet   argst   adapter(
+   R   t
+   getAnnotationt   Nonet   actiont   checkTemplatesR    t   zopet	   componentt   provideAdaptert   True(   R   R
+   t   configt   contextt   layerR   t	   templatest   adapts(    (    s:   /Users/cklinger/megrok/megrok.layout/megrok/layout/meta.pyt   execute   s    
+			c         C   s/   d „  } d „  } | i  | | d | | ƒ d  S(   Nc         S   s0   t  |  d d  ƒ } t  | d t ƒ } | o | S(   Nt   rendert   base_method(   t   getattrR   t   False(   R
+   R   R   (    (    s:   /Users/cklinger/megrok/megrok.layout/megrok/layout/meta.pyt
+   has_render(   s    c         S   s   t  |  d d  ƒ S(   NR   (   R    R   (   R
+   (    (    s:   /Users/cklinger/megrok/megrok.layout/megrok/layout/meta.pyt
+   has_no_render-   s    t   view(   R   (   R   R   R   R
+   R"   R#   (    (    s:   /Users/cklinger/megrok/megrok.layout/megrok/layout/meta.pyR   &   s    		(   t   __name__t
+   __module__t   martianR   R   t	   directivet   grokcoreR   R$   R   R   R   R   R   (    (    (    s:   /Users/cklinger/megrok/megrok.layout/megrok/layout/meta.pyR   
+   s   
+		(   R'   t   zope.componentR   t   grokcore.componentR)   t
+   megrok.layoutR    R   t!   zope.publisher.interfaces.browserR   t   ClassGrokkerR   (    (    (    s:   /Users/cklinger/megrok/megrok.layout/megrok/layout/meta.pys   <module>   s
+   
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/meta.zcml
===================================================================
--- megrok.layout/trunk/src/megrok/layout/meta.zcml	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/meta.zcml	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,11 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope"
+   xmlns:grok="http://namespaces.zope.org/grok">
+
+  <include package="grokcore.component" file="meta.zcml" />
+  <include package="grokcore.security" file="meta.zcml" />
+  <include package="grokcore.view" file="meta.zcml" />
+  <include package="grokcore.view.templatereg" file="meta.zcml" />
+  <grok:grok package=".meta" />
+
+</configure>

Added: megrok.layout/trunk/src/megrok/layout/testing.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/testing.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/testing.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,11 @@
+from zope.configuration.config import ConfigurationMachine
+from grokcore.component import zcml
+
+def grok(module_name):
+    config = ConfigurationMachine()
+    zcml.do_grok('grokcore.component.meta', config)
+    zcml.do_grok('grokcore.security.meta', config)
+    zcml.do_grok('grokcore.view.meta', config)
+    zcml.do_grok('grokcore.view.templatereg', config)
+    zcml.do_grok(module_name, config)
+    config.execute_actions()

Added: megrok.layout/trunk/src/megrok/layout/testing.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/testing.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/testing.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,2 @@
+³ò
+n)OJc           @   s-   d  d k  l Z d  d k l Z d „  Z d S(   iÿÿÿÿ(   t   ConfigurationMachine(   t   zcmlc         C   sg   t  ƒ  } t i d | ƒ t i d | ƒ t i d | ƒ t i d | ƒ t i |  | ƒ | i ƒ  d  S(   Ns   grokcore.component.metas   grokcore.security.metas   grokcore.view.metas   grokcore.view.templatereg(   R    R   t   do_grokt   execute_actions(   t   module_namet   config(    (    s=   /Users/cklinger/megrok/megrok.layout/megrok/layout/testing.pyt   grok   s    	N(   t   zope.configuration.configR    t   grokcore.componentR   R   (    (    (    s=   /Users/cklinger/megrok/megrok.layout/megrok/layout/testing.pys   <module>   s   
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/tests/__init__.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/tests/__init__.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/tests/__init__.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1 @@
+#

Added: megrok.layout/trunk/src/megrok/layout/tests/__init__.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/tests/__init__.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/tests/__init__.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,2 @@
+³ò
+‹ÉDJc           @   s   d  S(   N(    (    (    (    sD   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/__init__.pys   <module>   s    
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/tests/test_renderortemplate.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/tests/test_renderortemplate.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/tests/test_renderortemplate.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,31 @@
+"""
+  >>> grok.testing.grok(__name__) 
+  Traceback (most recent call last):
+  ...
+  ConfigurationExecutionError: <class 'martian.error.GrokError'>: View <class 'megrok.layout.tests.test_renderortemplate.View'> has no associated template or 'render' method.
+  in:
+  <BLANKLINE>
+"""
+
+import grokcore.component as grok
+from grokcore.view import View
+from megrok.layout import Layout
+from zope.interface import Interface
+
+
+class MyLayout(Layout):
+    grok.context(Interface)
+
+
+class View(View):
+    grok.context(Interface)
+
+
+def test_suite():
+    from zope.testing import doctest
+    from megrok.layout.ftests import FunctionalLayer
+    suite = doctest.DocTestSuite(
+        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
+        )
+    suite.layer = FunctionalLayer
+    return suite

Added: megrok.layout/trunk/src/megrok/layout/tests/test_renderortemplate.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/tests/test_renderortemplate.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/tests/test_renderortemplate.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,15 @@
+³ò
+í+OJc           @   s~   d  Z  d d k i Z d d k l Z d d k l Z d d k l	 Z	 d e f d „  ƒ  YZ
+ d e f d	 „  ƒ  YZ d
+ „  Z d S(   s  
+  >>> grok.testing.grok(__name__) 
+  Traceback (most recent call last):
+  ...
+  ConfigurationExecutionError: <class 'martian.error.GrokError'>: View <class 'megrok.layout.tests.test_renderortemplate.View'> has no associated template or 'render' method.
+  in:
+  <BLANKLINE>
+iÿÿÿÿN(   t   View(   t   Layout(   t	   Interfacet   MyLayoutc           B   s   e  Z e i e ƒ RS(    (   t   __name__t
+   __module__t   grokt   contextR   (    (    (    sQ   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/test_renderortemplate.pyR      s   R    c           B   s   e  Z e i e ƒ RS(    (   R   R   R   R   R   (    (    (    sQ   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/test_renderortemplate.pyR       s   c          C   sI   d d k  l }  d d k l } |  i d |  i |  i Bƒ } | | _ | S(   Niÿÿÿÿ(   t   doctest(   t   FunctionalLayert   optionflags(   t   zope.testingR   t   megrok.layout.ftestsR	   t   DocTestSuitet   NORMALIZE_WHITESPACEt   ELLIPSISt   layer(   R   R	   t   suite(    (    sQ   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/test_renderortemplate.pyt
+   test_suite   s    		(   t   __doc__t   grokcore.componentt	   componentR   t
+   grokcore.viewR    t
+   megrok.layoutR   t   zope.interfaceR   R   R   (    (    (    sQ   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/test_renderortemplate.pys   <module>   s   
\ No newline at end of file

Added: megrok.layout/trunk/src/megrok/layout/tests/test_samecontext.py
===================================================================
--- megrok.layout/trunk/src/megrok/layout/tests/test_samecontext.py	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/tests/test_samecontext.py	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,29 @@
+"""
+  >>> grok.testing.grok(__name__) 
+  Traceback (most recent call last):
+  ...
+  ConfigurationConflictError: Conflicting configuration actions
+        For: ('adapter', (<InterfaceClass zope.interface.Interface>, <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>), <InterfaceClass megrok.layout.interfaces.ILayout>)
+"""
+
+import grokcore.component as grok
+from megrok.layout import Layout
+from zope.interface import Interface
+
+
+class MyLayout(Layout):
+    grok.context(Interface)
+
+
+class MyOtherLayout(Layout):
+    grok.context(Interface)
+
+
+def test_suite():
+    from zope.testing import doctest
+    from megrok.layout.ftests import FunctionalLayer
+    suite = doctest.DocTestSuite(
+        optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS
+        )
+    suite.layer = FunctionalLayer
+    return suite

Added: megrok.layout/trunk/src/megrok/layout/tests/test_samecontext.pyc
===================================================================
--- megrok.layout/trunk/src/megrok/layout/tests/test_samecontext.pyc	                        (rev 0)
+++ megrok.layout/trunk/src/megrok/layout/tests/test_samecontext.pyc	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,14 @@
+³ò
+í+OJc           @   sn   d  Z  d d k i Z d d k l Z d d k l Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ	 d	 „  Z
+ d S(
+   sQ  
+  >>> grok.testing.grok(__name__) 
+  Traceback (most recent call last):
+  ...
+  ConfigurationConflictError: Conflicting configuration actions
+        For: ('adapter', (<InterfaceClass zope.interface.Interface>, <InterfaceClass zope.publisher.interfaces.browser.IDefaultBrowserLayer>), <InterfaceClass megrok.layout.interfaces.ILayout>)
+iÿÿÿÿN(   t   Layout(   t	   Interfacet   MyLayoutc           B   s   e  Z e i e ƒ RS(    (   t   __name__t
+   __module__t   grokt   contextR   (    (    (    sL   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/test_samecontext.pyR      s   t
+   MyOtherLayoutc           B   s   e  Z e i e ƒ RS(    (   R   R   R   R   R   (    (    (    sL   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/test_samecontext.pyR      s   c          C   sI   d d k  l }  d d k l } |  i d |  i |  i Bƒ } | | _ | S(   Niÿÿÿÿ(   t   doctest(   t   FunctionalLayert   optionflags(   t   zope.testingR   t   megrok.layout.ftestsR	   t   DocTestSuitet   NORMALIZE_WHITESPACEt   ELLIPSISt   layer(   R   R	   t   suite(    (    sL   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/test_samecontext.pyt
+   test_suite   s    		(   t   __doc__t   grokcore.componentt	   componentR   t
+   megrok.layoutR    t   zope.interfaceR   R   R   R   (    (    (    sL   /Users/cklinger/megrok/megrok.layout/megrok/layout/tests/test_samecontext.pys   <module>   s   
\ No newline at end of file

Added: megrok.layout/trunk/versions.cfg
===================================================================
--- megrok.layout/trunk/versions.cfg	                        (rev 0)
+++ megrok.layout/trunk/versions.cfg	2010-10-18 09:57:17 UTC (rev 117640)
@@ -0,0 +1,110 @@
+[versions]
+ClientForm = 0.2.9
+grokcore.component = 1.7
+grokcore.formlib = 1.1
+grokcore.security = 1.1
+grokcore.view = 1.7
+grokcore.viewlet = 1.0
+grokui.admin = 0.3.2
+martian = 0.11
+mechanize = 0.1.7b
+pytz = 2007k
+RestrictedPython = 3.4.2
+simplejson = 1.7.1
+z3c.autoinclude = 0.2.2
+z3c.flashmessage = 1.0
+z3c.testsetup = 0.2.1
+zc.catalog = 1.2.0
+ZConfig = 2.5.1
+zc.recipe.testrunner = 1.0.0
+zdaemon = 2.0.2
+ZODB3 = 3.8.1
+zodbcode = 3.4.0
+zope.annotation = 3.4.1
+zope.app.apidoc = 3.4.3
+zope.app.applicationcontrol = 3.4.3
+zope.app.appsetup = 3.4.1
+zope.app.authentication = 3.4.4
+zope.app.basicskin = 3.4.0
+zope.app.broken = 3.4.0
+zope.app.catalog = 3.5.1
+zope.app.component = 3.4.1
+zope.app.container = 3.5.6
+zope.app.content = 3.4.0
+zope.app.debug = 3.4.1
+zope.app.dependable = 3.4.0
+zope.app.error = 3.5.1
+zope.app.exception = 3.4.1
+zope.app.file = 3.4.4
+zope.app.folder = 3.4.0
+zope.app.form = 3.4.1
+zope.app.generations = 3.4.1
+zope.app.http = 3.4.1
+zope.app.i18n = 3.4.4
+zope.app.interface = 3.4.0
+zope.app.intid = 3.4.1
+zope.app.keyreference = 3.4.1
+zope.app.locales = 3.4.5
+zope.app.onlinehelp = 3.4.1
+zope.app.pagetemplate = 3.4.1
+zope.app.preference = 3.4.1
+zope.app.principalannotation = 3.4.0
+zope.app.publication = 3.4.3
+zope.app.publisher = 3.5.1
+zope.app.renderer = 3.4.0
+zope.app.rotterdam = 3.4.1
+zope.app.schema = 3.4.0
+zope.app.security = 3.5.2
+zope.app.securitypolicy = 3.4.6
+zope.app.server = 3.4.2
+zope.app.session = 3.5.1
+zope.app.skins = 3.4.0
+zope.app.testing = 3.4.3
+zope.app.tree = 3.4.0
+zope.app.twisted = 3.4.1
+zope.app.wsgi = 3.4.1
+zope.app.zapi = 3.4.0
+zope.app.zcmlfiles = 3.4.3
+zope.app.zopeappgenerations = 3.4.0
+zope.cachedescriptors = 3.4.1
+zope.component = 3.4.0
+zope.configuration = 3.4.0
+zope.contentprovider = 3.4.0
+zope.contenttype = 3.4.0
+zope.copypastemove = 3.4.0
+zope.datetime = 3.4.0
+zope.deferredimport = 3.4.0
+zope.deprecation = 3.4.0
+zope.dottedname = 3.4.2
+zope.dublincore = 3.4.0
+zope.error = 3.5.1
+zope.event = 3.4.0
+zope.exceptions = 3.4.0
+zope.filerepresentation = 3.4.0
+zope.formlib = 3.4.0
+zope.hookable = 3.4.0
+zope.i18n = 3.4.0
+zope.i18nmessageid = 3.4.3
+zope.index = 3.4.1
+zope.interface = 3.4.1
+zope.lifecycleevent = 3.4.0
+zope.location = 3.4.0
+zope.minmax = 1.1.0
+zope.modulealias = 3.4.0
+zope.pagetemplate = 3.4.0
+zope.proxy = 3.4.2
+zope.publisher = 3.4.9
+zope.schema = 3.4.0
+zope.security = 3.4.1
+zope.securitypolicy = 3.4.1
+zope.server = 3.4.3
+zope.session = 3.4.1
+zope.size = 3.4.0
+zope.structuredtext = 3.4.0
+zope.tal = 3.4.1
+zope.tales = 3.4.0
+zope.testbrowser = 3.4.2
+zope.testing = 3.7.6
+zope.thread = 3.4
+zope.traversing = 3.4.1
+zope.viewlet = 3.4.2



More information about the checkins mailing list