[Checkins] SVN: z3ext.layout/trunk/ added uid to layout directive
Nikolay Kim
fafhrd at datacom.kz
Wed Nov 26 12:30:45 EST 2008
Log message for revision 93369:
added uid to layout directive
Changed:
U z3ext.layout/trunk/CHANGES.txt
U z3ext.layout/trunk/setup.py
U z3ext.layout/trunk/src/z3ext/layout/configure.zcml
U z3ext.layout/trunk/src/z3ext/layout/interfaces.py
U z3ext.layout/trunk/src/z3ext/layout/zcml.py
-=-
Modified: z3ext.layout/trunk/CHANGES.txt
===================================================================
--- z3ext.layout/trunk/CHANGES.txt 2008-11-26 10:04:12 UTC (rev 93368)
+++ z3ext.layout/trunk/CHANGES.txt 2008-11-26 17:30:45 UTC (rev 93369)
@@ -2,6 +2,13 @@
CHANGES
=======
+1.6.0 (2008-11-27)
+------------------
+
+- Added 'uid' attribute to z3ext:layout directive.
+ Send ILayoutCreatedEvent event only if layout has uid
+
+
1.5.9 (2008-11-24)
------------------
Modified: z3ext.layout/trunk/setup.py
===================================================================
--- z3ext.layout/trunk/setup.py 2008-11-26 10:04:12 UTC (rev 93368)
+++ z3ext.layout/trunk/setup.py 2008-11-26 17:30:45 UTC (rev 93369)
@@ -21,7 +21,7 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-version='1.5.10dev'
+version='1.6.0dev'
setup(name='z3ext.layout',
Modified: z3ext.layout/trunk/src/z3ext/layout/configure.zcml
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/configure.zcml 2008-11-26 10:04:12 UTC (rev 93368)
+++ z3ext.layout/trunk/src/z3ext/layout/configure.zcml 2008-11-26 17:30:45 UTC (rev 93369)
@@ -30,14 +30,14 @@
<z3ext:layout
layout="viewspace"
for="zope.app.component.interfaces.ISite"
- title="Default layout (z3ext.layout)"
description="Default layout, registered for IDefaultBrowserLayer."
template="layoutcontent.pt" />
<z3ext:layout
name="viewspace"
+ title="Viewspace"
layout="workspace"
- title="Viewspace layout (z3ext.layout)"
+ uid="default.viewspace"
description="Default viewpsace layout, registered for IDefaultBrowserLayer."
for="zope.app.component.interfaces.ISite"
template="layoutviewspace.pt" />
@@ -45,14 +45,16 @@
<z3ext:layout
name="workspace"
layout="portal"
- title="Workspace layout (z3ext.layout)"
+ title="Workspace"
+ uid="default.workspace"
description="Default workspace layout, registered for IDefaultBrowserLayer."
for="zope.app.component.interfaces.ISite"
template="layoutworkspace.pt" />
<z3ext:layout
name="portal"
- title="Portal layout (z3ext.layout)"
+ title="Portal"
+ uid="default.portal"
description="Default portal layout, registered for IDefaultBrowserLayer"
for="zope.app.component.interfaces.ISite"
template="layoutportal.pt" />
Modified: z3ext.layout/trunk/src/z3ext/layout/interfaces.py
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/interfaces.py 2008-11-26 10:04:12 UTC (rev 93368)
+++ z3ext.layout/trunk/src/z3ext/layout/interfaces.py 2008-11-26 17:30:45 UTC (rev 93369)
@@ -67,6 +67,8 @@
class ILayoutCreatedEvent(interface.Interface):
""" notification about new layout """
+ uid = interface.Attribute('UID')
+
name = interface.Attribute('Name')
view = interface.Attribute('View')
Modified: z3ext.layout/trunk/src/z3ext/layout/zcml.py
===================================================================
--- z3ext.layout/trunk/src/z3ext/layout/zcml.py 2008-11-26 10:04:12 UTC (rev 93368)
+++ z3ext.layout/trunk/src/z3ext/layout/zcml.py 2008-11-26 17:30:45 UTC (rev 93369)
@@ -83,6 +83,11 @@
class ILayoutDirective(interface.Interface):
+ uid = schema.TextLine(
+ title = u"Unique layout id",
+ default = u'',
+ required = False)
+
template = Path(
title=u'Layout template.',
description=u"Refers to a file containing a page template (should "
@@ -154,7 +159,7 @@
def layoutDirective(
- _context, template='', for_=None, view=None, name = u'',
+ _context, uid='', template='', for_=None, view=None, name = u'',
layer = IDefaultBrowserLayer, provides = ILayout,
contentType='text/html', class_ = None, layout = '',
title='', description='', **kwargs):
@@ -224,11 +229,12 @@
provides, (interface.Interface, for_, layer))
# send ILayoutCreatedEvent event
- _context.action(
- discriminator = ('z3ext.layout', name, interface.Interface, for_, layer),
- callable = sendNotification,
- args = (name, interface.Interface, for_, layer, newclass, kwargs),
- order = 99999999)
+ if uid:
+ _context.action(
+ discriminator = ('z3ext.layout', uid),
+ callable = sendNotification,
+ args = (uid, name, interface.Interface, for_, layer, newclass, kwargs),
+ order = 99999999)
if view is not None:
# register the template
@@ -240,17 +246,20 @@
provides, (view, interface.Interface, layer))
# send ILayoutCreatedEvent event
- _context.action(
- discriminator = ('z3ext.layout', name, view, interface.Interface, layer),
- callable = sendNotification,
- args = (name, view, interface.Interface, layer, newclass, kwargs),
- order = 99999999)
+ if uid:
+ _context.action(
+ discriminator = ('z3ext.layout', uid),
+ callable = sendNotification,
+ args = (uid, name, view, interface.Interface, layer, newclass, kwargs),
+ order = 99999999)
class LayoutCreatedEvent(object):
interface.implements(ILayoutCreatedEvent)
- def __init__(self, name, view, context, layer, layoutclass, keywords):
+ def __init__(self, uid, name, view,
+ context, layer, layoutclass, keywords):
+ self.uid = uid
self.name = name
self.view = view
self.context = context
@@ -259,9 +268,9 @@
self.keywords = keywords
-def sendNotification(name, view, context, layer, layoutclass, keywords):
+def sendNotification(uid, name, view, context, layer, layoutclass, keywords):
event.notify(LayoutCreatedEvent(
- name, view, context, layer, layoutclass, keywords))
+ uid, name, view, context, layer, layoutclass, keywords))
# pagelet directive
More information about the Checkins
mailing list