[Checkins] SVN: Sandbox/dusty/z3c.hroles/trunk/ Initial import of
z3c.hroles; a package that allows the definition of
Daniel Nouri
daniel.nouri at gmail.com
Mon Jul 28 12:20:05 EDT 2008
Log message for revision 88872:
Initial import of z3c.hroles; a package that allows the definition of
hierarchical and inheriting roles definitions.
Changed:
A Sandbox/dusty/z3c.hroles/trunk/
A Sandbox/dusty/z3c.hroles/trunk/.installed.cfg
A Sandbox/dusty/z3c.hroles/trunk/CHANGES.txt
A Sandbox/dusty/z3c.hroles/trunk/LICENSE.txt
A Sandbox/dusty/z3c.hroles/trunk/README.txt
A Sandbox/dusty/z3c.hroles/trunk/bootstrap.py
A Sandbox/dusty/z3c.hroles/trunk/buildout.cfg
A Sandbox/dusty/z3c.hroles/trunk/setup.py
A Sandbox/dusty/z3c.hroles/trunk/src/
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/__init__.py
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/README.txt
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/SETUP.cfg
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/__init__.py
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/interfaces.py
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/meta.zcml
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/formframe.pt
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_display.pt
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_input.pt
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_display.pt
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_input.pt
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/z3c.hroles-meta.zcml
A Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/zcml.py
-=-
Added: Sandbox/dusty/z3c.hroles/trunk/.installed.cfg
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/.installed.cfg (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/.installed.cfg 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,35 @@
+[buildout]
+installed_develop_eggs = /home/daniel/tmp/z3c.hroles/trunk/develop-eggs/z3c.hroles.egg-link
+parts = test coverage
+
+[test]
+__buildout_installed__ = /home/daniel/tmp/z3c.hroles/trunk/parts/test
+ /home/daniel/tmp/z3c.hroles/trunk/bin/test
+__buildout_signature__ = zc.recipe.testrunner-1.0.0-py2.4.egg zc.recipe.egg-1.1.0-py2.4.egg setuptools-KlCm3nOL2f6oj0x5nqCo6g== zope.testing-3.6.0-py2.4.egg zc.buildout-1.1.0-py2.4.egg zc.buildout-1.1.0-py2.4.egg zope.interface-KlCm3nOL2f6oj0x5nqCo6g==
+_b = /home/daniel/tmp/z3c.hroles/trunk/bin
+_d = /home/daniel/tmp/z3c.hroles/trunk/develop-eggs
+_e = /home/daniel/.buildout/cache
+bin-directory = /home/daniel/tmp/z3c.hroles/trunk/bin
+develop-eggs-directory = /home/daniel/tmp/z3c.hroles/trunk/develop-eggs
+eggs = z3c.hroles
+eggs-directory = /home/daniel/.buildout/cache
+executable = /usr/bin/python2.4
+index = http://download.zope.org/ppix
+location = /home/daniel/tmp/z3c.hroles/trunk/parts/test
+recipe = zc.recipe.testrunner
+script = /home/daniel/tmp/z3c.hroles/trunk/bin/test
+
+[coverage]
+__buildout_installed__ = /home/daniel/tmp/z3c.hroles/trunk/bin/coverage
+ /home/daniel/tmp/z3c.hroles/trunk/bin/coveragediff
+__buildout_signature__ = zc.recipe.egg-1.1.0-py2.4.egg setuptools-KlCm3nOL2f6oj0x5nqCo6g== zc.buildout-1.1.0-py2.4.egg
+_b = /home/daniel/tmp/z3c.hroles/trunk/bin
+_d = /home/daniel/tmp/z3c.hroles/trunk/develop-eggs
+_e = /home/daniel/.buildout/cache
+bin-directory = /home/daniel/tmp/z3c.hroles/trunk/bin
+develop-eggs-directory = /home/daniel/tmp/z3c.hroles/trunk/develop-eggs
+eggs = z3c.coverage
+eggs-directory = /home/daniel/.buildout/cache
+executable = /usr/bin/python2.4
+index = http://download.zope.org/ppix
+recipe = zc.recipe.egg
Property changes on: Sandbox/dusty/z3c.hroles/trunk/.installed.cfg
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/CHANGES.txt
===================================================================
Property changes on: Sandbox/dusty/z3c.hroles/trunk/CHANGES.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/LICENSE.txt
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/LICENSE.txt (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/LICENSE.txt 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,54 @@
+Zope Public License (ZPL) Version 2.1
+-------------------------------------
+
+A copyright notice accompanies this license document that
+identifies the copyright holders.
+
+This license has been certified as open source. It has also
+been designated as GPL compatible by the Free Software
+Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions in source code must retain the
+ accompanying copyright notice, this list of conditions,
+ and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to
+ endorse or promote products derived from this software
+ without prior written permission from the copyright
+ holders.
+
+4. The right to distribute this software or to use it for
+ any purpose does not give you the right to use
+ Servicemarks (sm) or Trademarks (tm) of the copyright
+ holders. Use of them is covered by separate agreement
+ with the copyright holders.
+
+5. If any files are modified, you must cause the modified
+ files to carry prominent notices stating that you changed
+ the files and the date of any change.
+
+Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+ AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
Property changes on: Sandbox/dusty/z3c.hroles/trunk/LICENSE.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/README.txt
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/README.txt (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/README.txt 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,2 @@
+This package provides hierarchical roles, this way roles can automatically
+include other roles.
Property changes on: Sandbox/dusty/z3c.hroles/trunk/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/bootstrap.py
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/bootstrap.py (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/bootstrap.py 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2007 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 75940 2007-05-24 14:45:00Z srichter $
+"""
+
+import os, shutil, sys, tempfile, urllib2
+
+tmpeggs = tempfile.mkdtemp()
+
+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
+
+cmd = 'from setuptools.command.easy_install import main; main()'
+if sys.platform == 'win32':
+ cmd = '"%s"' % cmd # work around spawn lamosity on windows
+
+ws = pkg_resources.working_set
+assert os.spawnle(
+ os.P_WAIT, sys.executable, sys.executable,
+ '-c', cmd, '-mqNxd', 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)
Property changes on: Sandbox/dusty/z3c.hroles/trunk/bootstrap.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/buildout.cfg
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/buildout.cfg (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/buildout.cfg 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,12 @@
+[buildout]
+develop = .
+parts = test coverage
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3c.hroles
+
+[coverage]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
+
Property changes on: Sandbox/dusty/z3c.hroles/trunk/buildout.cfg
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/setup.py
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/setup.py (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/setup.py 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,14 @@
+from setuptools import setup, find_packages
+
+setup(
+ name="z3c.hroles",
+ version="0.1",
+ description = "This package provides hierarchical roles for Zope 3. "
+ "This way roles can automatically include other roles.",
+ author="Hermann Himmelbauer",
+ author_email="dusty at qwer.tk",
+
+ packages=find_packages('src'),
+ package_dir={'':'src'},
+ namespace_packages=['z3c'],
+)
Property changes on: Sandbox/dusty/z3c.hroles/trunk/setup.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/__init__.py
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/__init__.py (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/__init__.py 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,6 @@
+try:
+ # Declare this a namespace package if pkg_resources is available.
+ import pkg_resources
+ pkg_resources.declare_namespace('z3c')
+except ImportError:
+ pass
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/README.txt
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/README.txt (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/README.txt 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,74 @@
+========================
+Hierarchial roles
+========================
+
+Hierarchical roles are roles that can include other roles. This way,
+hierarchical roles can be created. For instance, one can think of
+the following roles:
+
+1) Visitor (An anonymous role)
+2) Registered (Registered Users)
+3) Admin (The Administrator)
+
+In this example, the registered user should have the same permissions
+as the visitor, and the admin should have the same as the registered user
+and some extra permissions.
+
+In ZCML, this can be handled like this:
+
+<permission
+ id="p1"
+ title="Look at a page"
+/>
+
+<permission
+ id="p2"
+ title="Edit a page"
+/>
+
+<permission
+ id="p3"
+ title="Administer Users"
+/>
+
+<hrole
+ id="test.Visitor"
+ title="Anonymous Visitor"
+/>
+
+<hrole
+ id="test.Registered"
+ title="Registered User"
+ includes = "test.Visitor"
+/>
+
+<hrole
+ id="test.Admin"
+ title="Administrator"
+ includes = "test.Registered"
+/>
+
+<grant
+ permission="p1"
+ role="test.Visitor"
+/>
+
+<grant
+ permission="p2"
+ role="test.Registered"
+/>
+
+<grant
+ permission="p3"
+ role="test.Admin"
+/>
+
+The Administrator will now have permission p1, p2 and p3. It is also
+possible to include multiple permissions:
+
+<hrole
+ id="test.Admin"
+ title="Administrator"
+ includes = "test.Visitor, test.Registered"
+/>
+
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/README.txt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/SETUP.cfg
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/SETUP.cfg (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/SETUP.cfg 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,3 @@
+<data-files zopeskel/etc/package-includes>
+ z3c.formsnippet-*.zcml
+</data-files>
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/SETUP.cfg
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/__init__.py
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/__init__.py (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/__init__.py 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,32 @@
+# coding=utf-8
+""" Hierarchical Roles - basic classes and functions """
+
+from zope.interface import implements
+from zope.component import getUtilitiesFor, getUtility
+from zope.securitypolicy.role import Role
+
+from z3c.hroles.interfaces import IHRole
+
+class HRole(Role):
+ implements(IHRole)
+
+ def __init__(self, id, title, description="", includes=None):
+ self.includes = includes
+ super(HRole, self).__init__(id, title, description)
+
+def getIncludedRoles(context, id):
+ """ Get matching hierarchical roles """
+ roles = []
+ role = getUtility(IHRole, id, context)
+ roles.append(role)
+ inc_roles = getattr(role, 'includes', None)
+ if inc_roles:
+ for inc_role in inc_roles:
+ roles.extend(getIncludedRoles(context, inc_role))
+ return roles
+
+def getHRoles(context, prefix):
+ """ Return all available HRoles with the given specific prefix """
+ roles = getUtilitiesFor(IHRole, context)
+ return [role for name, role in roles if role.id.startswith(prefix)]
+
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/__init__.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/interfaces.py
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/interfaces.py (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/interfaces.py 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,18 @@
+# coding = utf-8
+""" Interfaces for hierarchical roles """
+
+from zope.schema import TextLine
+from zope.securitypolicy.interfaces import IRole
+
+class IHRole(IRole):
+ """A hierarchical role object."""
+
+ includes = TextLine(
+ title=u"Includes",
+ description=u"Role includes other roles",
+ required=False)
+
+
+
+
+
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/interfaces.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/meta.zcml
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/meta.zcml (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/meta.zcml 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,16 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:meta="http://namespaces.zope.org/meta">
+
+ <meta:directives namespace="http://namespaces.zope.org/z3c">
+
+ <meta:directive
+ name="hrole"
+ schema=".zcml.IDefineHRoleDirective"
+ handler=".zcml.defineHRole"
+ />
+
+ </meta:directives>
+
+</configure>
+
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/meta.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/formframe.pt
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/formframe.pt (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/formframe.pt 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,34 @@
+<form action="." method="post" enctype="multipart/form-data" class="edit-form"
+ metal:define-macro="form"
+ tal:attributes="method view/method;
+ enctype view/enctype;
+ acceptCharset view/acceptCharset;
+ accept view/accept;
+ action view/action;
+ name view/name;
+ id view/id">
+
+<div class="status"
+ tal:condition="view/widgets/errors">
+<ul class="errors"
+ tal:condition="view/widgets/errors">
+ <li tal:repeat="error view/widgets/errors">
+ <tal:block condition="error/widget">
+ <span tal:replace="error/widget/label" />:
+ </tal:block>
+ <span tal:replace="structure error/render">Error Type</span>
+ </li>
+</ul>
+</div>
+
+
+<span tal:replace="structure view/template" />
+
+<p />
+<div class="buttons">
+ <input tal:repeat="action view/actions/values"
+ tal:replace="structure action/render"
+ />
+</div>
+</form>
+
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/formframe.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_display.pt
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_display.pt (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_display.pt 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,2 @@
+<div tal:content="structure view/label">widget label</div>
+<div tal:content="structure view/render">widget</div>
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_display.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_input.pt
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_input.pt (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_input.pt 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,12 @@
+<div class="label">
+ <label tal:attributes="for view/id">
+ <span i18n:translate="" tal:content="view/label">label</span>
+ <span class="required" tal:condition="view/required">*</span>
+ </label>
+</div>
+<div class="widget" tal:content="structure view/render">
+ <input type="text"/>
+</div>
+<div class="error" tal:condition="view/error">
+ <span tal:replace="structure view/error/render">error</span>
+</div>
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_div_input.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_display.pt
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_display.pt (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_display.pt 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,4 @@
+<div>
+<span tal:replace="structure view/label" />:
+<span tal:replace="structure view/render" />
+</div>
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_display.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_input.pt
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_input.pt (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_input.pt 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,12 @@
+<span class="label">
+ <label tal:attributes="for view/id">
+ <span i18n:translate="" tal:content="view/label">label</span>
+ <span class="required" tal:condition="view/required">*</span>
+ </label>
+</span>
+<span class="widget" tal:content="structure view/render">
+ <input type="text"/>
+</span>
+<span class="error" tal:condition="view/error">
+ <span tal:replace="structure view/error/render">error</span>
+</span>
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/pt/snippet_span_input.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/z3c.hroles-meta.zcml
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/z3c.hroles-meta.zcml (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/z3c.hroles-meta.zcml 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,6 @@
+<configure
+ xmlns:zcml="http://namespaces.zope.org/zcml">
+
+ <include package="z3c.hroles" file="meta.zcml" />
+
+</configure>
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/z3c.hroles-meta.zcml
___________________________________________________________________
Name: svn:eol-style
+ native
Added: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/zcml.py
===================================================================
--- Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/zcml.py (rev 0)
+++ Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/zcml.py 2008-07-28 16:20:01 UTC (rev 88872)
@@ -0,0 +1,27 @@
+"""
+Meta configuration of hierarchical roles
+"""
+
+from zope.configuration.fields import MessageID
+from zope.component.zcml import utility
+
+from z3c.hroles.interfaces import IHRole
+from z3c.hroles import HRole
+
+from zope.securitypolicy.metadirectives import IDefineRoleDirective
+
+class IDefineHRoleDirective(IDefineRoleDirective):
+ """Define a new hierarchical role."""
+
+ includes = MessageID(
+ title=u"Includes",
+ description=u"Included Roles",
+ required=False)
+
+
+def defineHRole(_context, id, title, description='', includes=''):
+ iroles = includes.split()
+ role = HRole(id, title, description, iroles)
+ utility(_context, IHRole, role, name=id)
+
+
Property changes on: Sandbox/dusty/z3c.hroles/trunk/src/z3c/hroles/zcml.py
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Checkins
mailing list