[Checkins] SVN: z3ext.cssregistry/tags/1.3.0/ release tag
Nikolay Kim
fafhrd at datacom.kz
Thu Oct 9 12:23:44 EDT 2008
Log message for revision 91921:
release tag
Changed:
A z3ext.cssregistry/tags/1.3.0/
D z3ext.cssregistry/tags/1.3.0/CHANGES.txt
A z3ext.cssregistry/tags/1.3.0/CHANGES.txt
D z3ext.cssregistry/tags/1.3.0/buildout.cfg
A z3ext.cssregistry/tags/1.3.0/buildout.cfg
A z3ext.cssregistry/tags/1.3.0/i18nall.in
A z3ext.cssregistry/tags/1.3.0/i18ncheck.in
D z3ext.cssregistry/tags/1.3.0/setup.py
A z3ext.cssregistry/tags/1.3.0/setup.py
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/README.txt
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/README.txt
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configlet.zcml
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configlet.zcml
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.pt
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.pt
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.py
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.py
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configure.zcml
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configure.zcml
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/i18n.py
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/interfaces.py
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/interfaces.py
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/locales/
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/property.py
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/property.py
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/registry.py
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/registry.py
D z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/zcml.py
A z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/zcml.py
-=-
Copied: z3ext.cssregistry/tags/1.3.0 (from rev 91907, z3ext.cssregistry/trunk)
Deleted: z3ext.cssregistry/tags/1.3.0/CHANGES.txt
===================================================================
--- z3ext.cssregistry/trunk/CHANGES.txt 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/CHANGES.txt 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,54 +0,0 @@
-=======
-CHANGES
-=======
-
-1.2.2 (2008-04-01)
-------------------
-
-- Configlet declaration moved to seperate zcml file
-
-
-1.2.1 (2008-03-31)
-------------------
-
-- Fix wrong import
-
-
-1.2.0 (2008-03-21)
-------------------
-
-- tests updated
-
-- move to svn.zope.org
-
-
-1.1.3 (2008-02-11)
-------------------
-
-- Fixed control panel configlet
-
-
-1.1.2 (2008-02-08)
-------------------
-
-- Security declarations fixed
-
-
-1.1.1 (2008-02-08)
-------------------
-
-- Remove support cssregistry as utility
-
-
-1.1.0 (2008-02-08)
-------------------
-
-- Added controlpanel configlet
-
-- Code cleanup
-
-
-1.0.0 (2007-12-01)
-------------------
-
-- Initial release.
Copied: z3ext.cssregistry/tags/1.3.0/CHANGES.txt (from rev 91920, z3ext.cssregistry/trunk/CHANGES.txt)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/CHANGES.txt (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/CHANGES.txt 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,62 @@
+=======
+CHANGES
+=======
+
+1.3.0 (2008-10-10)
+------------------
+
+- Update i18n
+
+- Do not use Persistent for registry and property
+
+
+1.2.2 (2008-04-01)
+------------------
+
+- Configlet declaration moved to seperate zcml file
+
+
+1.2.1 (2008-03-31)
+------------------
+
+- Fix wrong import
+
+
+1.2.0 (2008-03-21)
+------------------
+
+- tests updated
+
+- move to svn.zope.org
+
+
+1.1.3 (2008-02-11)
+------------------
+
+- Fixed control panel configlet
+
+
+1.1.2 (2008-02-08)
+------------------
+
+- Security declarations fixed
+
+
+1.1.1 (2008-02-08)
+------------------
+
+- Remove support cssregistry as utility
+
+
+1.1.0 (2008-02-08)
+------------------
+
+- Added controlpanel configlet
+
+- Code cleanup
+
+
+1.0.0 (2007-12-01)
+------------------
+
+- Initial release.
Deleted: z3ext.cssregistry/tags/1.3.0/buildout.cfg
===================================================================
--- z3ext.cssregistry/trunk/buildout.cfg 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/buildout.cfg 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,18 +0,0 @@
-[buildout]
-develop = .
-parts = test coverage-test coverage-report
-
-[test]
-recipe = zc.recipe.testrunner
-eggs = z3ext.cssregistry [test]
-
-[coverage-test]
-recipe = zc.recipe.testrunner
-eggs = z3ext.cssregistry [test]
-defaults = ['--coverage', '../../coverage']
-
-[coverage-report]
-recipe = zc.recipe.egg
-eggs = z3c.coverage
-scripts = coverage=coverage-report
-arguments = ('coverage', 'coverage/report')
Copied: z3ext.cssregistry/tags/1.3.0/buildout.cfg (from rev 91920, z3ext.cssregistry/trunk/buildout.cfg)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/buildout.cfg (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/buildout.cfg 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,64 @@
+[buildout]
+develop = .
+parts = test coverage-test coverage-report
+ i18n- i18nall i18ncheck i18ndude
+
+[test]
+recipe = zc.recipe.testrunner
+eggs = z3ext.cssregistry [test]
+
+[coverage-test]
+recipe = zc.recipe.testrunner
+eggs = z3ext.cssregistry [test]
+defaults = ['--coverage', '../../coverage']
+
+[coverage-report]
+recipe = zc.recipe.egg
+eggs = z3c.coverage
+scripts = coverage=coverage-report
+arguments = ('coverage', 'coverage/report')
+
+[i18n-]
+recipe = z3c.recipe.i18n:i18n
+packages = z3ext.cssregistry
+domain = z3ext.cssregistry
+output = ${buildout:directory}/src/z3ext/cssregistry/locales
+eggs = z3ext.cssregistry [test]
+zcml =
+ <configure i18n_domain="zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ xmlns:browser="http://namespaces.zope.org/browser">
+ <include package="zope.component" file="meta.zcml" />
+ <include package="zope.securitypolicy" file="meta.zcml" />
+ <include package="zope.viewlet" file="meta.zcml" />
+ <include package="zope.app.component" file="meta.zcml" />
+ <include package="zope.app.security" file="meta.zcml" />
+ <include package="zope.app.pagetemplate" file="meta.zcml" />
+
+ <include package="zope.securitypolicy" />
+ <include package="zope.contentprovider" />
+ <include package="zope.app.security" />
+ <include package="zope.app.zcmlfiles" />
+ <include package="zope.app.authentication" />
+
+ <include package="z3c.autoinclude" file="meta.zcml" />
+ <include package="z3ext.layout" file="meta.zcml" />
+ <include package="z3ext.controlpanel" file="meta.zcml" />
+ <include package="z3ext.cssregistry" file="meta.zcml" />
+ <include package="z3ext.cssregistry" />
+ </configure>
+
+[i18nall]
+recipe = buildout_script
+template_dir = ${buildout:directory}/
+template = i18nall.in
+
+[i18ncheck]
+recipe = buildout_script
+template_dir = ${buildout:directory}/
+template = i18ncheck.in
+
+[i18ndude]
+unzip = true
+recipe = zc.recipe.egg
+eggs = i18ndude
Copied: z3ext.cssregistry/tags/1.3.0/i18nall.in (from rev 91920, z3ext.cssregistry/trunk/i18nall.in)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/i18nall.in (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/i18nall.in 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+update_egg()
+{
+ echo "Start update $@"
+
+ bin/i18n_${2}_extract && \
+ bin/i18n_${2}_mergeall && \
+ msgfmt ${1}/locales/nl/LC_MESSAGES/${2}.po -o ${1}/locales/nl/LC_MESSAGES/${2}.mo --no-hash && \
+ msgfmt ${1}/locales/en/LC_MESSAGES/${2}.po -o ${1}/locales/en/LC_MESSAGES/${2}.mo --no-hash
+}
+
+update_egg src/z3ext/cssregistry z3ext && \
Copied: z3ext.cssregistry/tags/1.3.0/i18ncheck.in (from rev 91920, z3ext.cssregistry/trunk/i18ncheck.in)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/i18ncheck.in (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/i18ncheck.in 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Startup or shutdown buildbot
+
+bin/i18ndude find-untranslated ./ | grep z3ext.cssregistry | less
Deleted: z3ext.cssregistry/tags/1.3.0/setup.py
===================================================================
--- z3ext.cssregistry/trunk/setup.py 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/setup.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,71 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""Setup for z3ext.cssregistry package
-
-$Id$
-"""
-import os
-from setuptools import setup, find_packages
-
-def read(*rnames):
- return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-
-version = '1.2.3dev'
-
-
-setup(name='z3ext.cssregistry',
- version=version,
- description="CSS Registry - zrt-cssregistry command for z3c.zrtresource",
- long_description=(
- 'Detailed Dcoumentation\n' +
- '======================\n'
- + '\n\n' +
- read('src', 'z3ext', 'cssregistry', 'README.txt')
- + '\n\n' +
- read('CHANGES.txt')
- ),
- classifiers=[
- 'Development Status :: 5 - Production/Stable',
- 'Environment :: Web Environment',
- 'Intended Audience :: Developers',
- 'License :: OSI Approved :: Zope Public License',
- 'Programming Language :: Python',
- 'Natural Language :: English',
- 'Operating System :: OS Independent',
- 'Topic :: Internet :: WWW/HTTP',
- 'Framework :: Zope3'],
- author='Nikolay Kim',
- author_email='fafhrd91 at gmail.com',
- url='http://z3ext.net/',
- license='ZPL 2.1',
- packages=find_packages('src'),
- package_dir = {'':'src'},
- namespace_packages=['z3ext'],
- install_requires = ['setuptools',
- 'zope.schema',
- 'zope.proxy',
- 'zope.interface',
- 'zope.component',
- 'zope.i18nmessageid',
- 'zope.configuration',
- 'z3c.zrtresource>=1.1.0',
- ],
- extras_require = dict(test=['zope.app.testing',
- 'zope.testing',
- 'zope.publisher',
- 'zope.traversing',
- ]),
- include_package_data = True,
- zip_safe = False,
- )
Copied: z3ext.cssregistry/tags/1.3.0/setup.py (from rev 91920, z3ext.cssregistry/trunk/setup.py)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/setup.py (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/setup.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,77 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""Setup for z3ext.cssregistry package
+
+$Id$
+"""
+import os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+version = '1.3.0'
+
+
+setup(name='z3ext.cssregistry',
+ version=version,
+ description="CSS Registry - zrt-cssregistry command for z3c.zrtresource",
+ long_description=(
+ 'Detailed Dcoumentation\n' +
+ '======================\n'
+ + '\n\n' +
+ read('src', 'z3ext', 'cssregistry', 'README.txt')
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Framework :: Zope3'],
+ author='Nikolay Kim',
+ author_email='fafhrd91 at gmail.com',
+ url='http://z3ext.net/',
+ license='ZPL 2.1',
+ packages=find_packages('src'),
+ package_dir = {'':'src'},
+ namespace_packages=['z3ext'],
+ install_requires = ['setuptools',
+ 'zope.schema',
+ 'zope.proxy',
+ 'zope.interface',
+ 'zope.component',
+ 'zope.i18nmessageid',
+ 'zope.configuration',
+ 'z3c.autoinclude',
+ 'z3c.zrtresource>=1.1.0',
+ ],
+ extras_require = dict(test=['zope.app.testing',
+ 'zope.testing',
+ 'zope.publisher',
+ 'zope.traversing',
+ 'zope.securitypolicy',
+ 'zope.app.zcmlfiles',
+ 'z3ext.layout',
+ 'z3ext.controlpanel',
+ 'z3ext.statusmessage',
+ ]),
+ include_package_data = True,
+ zip_safe = False,
+ )
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/README.txt
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/README.txt 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/README.txt 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,207 +0,0 @@
-============
-CSS Registry
-============
-
-A registry for linked Stylesheet files and Javascripts.
-
-This registry is mainly aimed at solving the following usecases:
-
- - Enable skin developer to change css properties without having to
- resort to override css files itself
-
- - Enable more componentialization of the stylesheets.
-
-Some usefull imports
-
- >>> from zope import interface, component
- >>> from zope.interface.verify import verifyObject
- >>> from z3ext.cssregistry.interfaces import \
- ... Layer, ICSSRegistry, ICSSRegistryLayer
-
- >>> from zope.publisher.browser import TestRequest
- >>> request = TestRequest()
-
-Load directive declaration
-
- >>> from zope.configuration import xmlconfig
- >>> context = xmlconfig.string("""
- ... <configure>
- ... <include package="z3ext.cssregistry" file="meta.zcml" />
- ... </configure>""")
-
-Now we can create css registry
-
- >>> context = xmlconfig.string("""
- ... <configure xmlns:browser="http://namespaces.zope.org/browser">
- ... <browser:cssregistry>
- ... <property name="color1" value="#f5f5f5" />
- ... <property name="color2" value="white" />
- ... <property name="fontFamilyH1" value="Verdana" />
- ... <property name="fontFamilyH2" value="Arial" />
- ... </browser:cssregistry>
- ... </configure>""", context)
-
-`browser:cssregistry` diretive creates ICSSRegistry. It accepts name,title,layer
-parameters. All parameters not required, by default registry will have blank name
-and registered against IDefaultBrowserLayer layer. We can't register cssregistry
-for layer, because in that case it whould be available as resource (++resource++)
-So directive register multi adapter for ICSSRegistryLayer and supplied layer
-
- >>> registry = component.getMultiAdapter((Layer, Layer, request), ICSSRegistry)
- >>> verifyObject(ICSSRegistry, registry)
- True
-
- >>> registry['color1'].value
- u'#f5f5f5'
-
- >>> registry['fontFamilyH1'].value
- u'Verdana'
-
-We also can add more properties later:
-
- >>> context = xmlconfig.string("""
- ... <configure xmlns:browser="http://namespaces.zope.org/browser">
- ... <browser:cssproperty name="color3" value="#225593" />
- ... </configure>""", context)
-
- >>> registry['color3'].value
- u'#225593'
-
-
-zrt command
------------
-
-z3ext.cssregistry package aslo register new command for z3c.zrtresource.
-
- >>> from z3ext.cssregistry.command import cssregistry_factory
- >>> from z3c.zrtresource.interfaces import IZRTCommandFactory
-
- >>> component.provideUtility(cssregistry_factory, IZRTCommandFactory, 'cssregistry')
-
-Now we can use cssregistry for zrtresource resources
-
- >>> import tempfile
- >>> fn = tempfile.mktemp('.css')
- >>> open(fn, 'w').write('''\
- ... /* zrt-cssregistry: */
- ... h1 {
- ... color: color1;
- ... font: fontFamilyH1;
- ... }
- ...
- ... h2 {
- ... color: color2;
- ... font: fontFamilyH2;
- ... }''')
-
- >>> from z3c.zrtresource.zrtresource import ZRTFileResourceFactory
- >>> cssFactory = ZRTFileResourceFactory(fn, None, 'site.css')
-
- >>> from zope.publisher.browser import TestRequest
- >>> css = cssFactory(TestRequest())
-
- >>> print css.GET()
- h1 {
- color: #f5f5f5;
- font: Verdana;
- }
- <BLANKLINE>
- h2 {
- color: white;
- font: Arial;
- }
-
-Now if we need change css file we only need change cssregistry properties
-
- >>> registry['color1'].value = 'black'
-
- >>> print css.GET()
- h1 {
- color: black;
- font: Verdana;
- }
- <BLANKLINE>
- h2 {
- color: white;
- font: Arial;
- }
-
-We also can use named cssregistries
-
- >>> context = xmlconfig.string("""
- ... <configure xmlns:browser="http://namespaces.zope.org/browser">
- ... <browser:cssregistry name="mycss">
- ... <property name="color1" value="#d5d5d5" />
- ... <property name="color2" value="black" />
- ... <property name="fontFamilyH1" value="Tahoma" />
- ... <property name="fontFamilyH2" value="Courier" />
- ... </browser:cssregistry>
- ... </configure>""", context)
-
- >>> open(fn, 'w').write('''\
- ... /* zrt-cssregistry: mycss */
- ... h1 {
- ... color: color1;
- ... font: fontFamilyH1;
- ... }
- ...
- ... h2 {
- ... color: color2;
- ... font: fontFamilyH2;
- ... }''')
-
- >>> print css.GET()
- h1 {
- color: #d5d5d5;
- font: Tahoma;
- }
- <BLANKLINE>
- h2 {
- color: black;
- font: Courier;
- }
-
-If cssregistry is unknown nothing will happen
-
- >>> open(fn, 'w').write('''\
- ... /* zrt-cssregistry: unknown */
- ... h1 {
- ... color: color1;
- ... font: fontFamilyH1;
- ... }''')
- >>> print css.GET()
- h1 {
- color: color1;
- font: fontFamilyH1;
- }
-
-
-Registry methods
-----------------
-
- >>> registry.keys()
- [u'color1', u'color3', u'color2', u'fontFamilyH2', u'fontFamilyH1']
-
- >>> list(iter(registry))
- [u'color1', u'color3', u'color2', u'fontFamilyH2', u'fontFamilyH1']
-
- >>> for key, prop in registry.items():
- ... print key, prop
- color1 <z3ext.cssregistry.property.CSSProperty ...>
- color3 <z3ext.cssregistry.property.CSSProperty ...>
- color2 <z3ext.cssregistry.property.CSSProperty ...>
- fontFamilyH2 <z3ext.cssregistry.property.CSSProperty ...>
- fontFamilyH1 <z3ext.cssregistry.property.CSSProperty ...>
-
- >>> len(registry)
- 5
-
- >>> u'color1' in registry
- True
-
- >>> registry.get(u'color1')
- <z3ext.cssregistry.property.CSSProperty ...>
-
- >>> del registry[u'color1']
- >>> registry.keys()
- [u'color3', u'color2', u'fontFamilyH2', u'fontFamilyH1']
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/README.txt (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/README.txt)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/README.txt (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/README.txt 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,207 @@
+============
+CSS Registry
+============
+
+A registry for linked Stylesheet files and Javascripts.
+
+This registry is mainly aimed at solving the following usecases:
+
+ - Enable skin developer to change css properties without having to
+ resort to override css files itself
+
+ - Enable more componentialization of the stylesheets.
+
+Some usefull imports
+
+ >>> from zope import interface, component
+ >>> from zope.interface.verify import verifyObject
+ >>> from z3ext.cssregistry.interfaces import \
+ ... Layer, ICSSRegistry, ICSSRegistryLayer
+
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
+
+Load directive declaration
+
+ >>> from zope.configuration import xmlconfig
+ >>> context = xmlconfig.string("""
+ ... <configure>
+ ... <include package="z3ext.cssregistry" file="meta.zcml" />
+ ... </configure>""")
+
+Now we can create css registry
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:browser="http://namespaces.zope.org/browser">
+ ... <browser:cssregistry>
+ ... <property name="color1" value="#f5f5f5" />
+ ... <property name="color2" value="white" />
+ ... <property name="fontFamilyH1" value="Verdana" />
+ ... <property name="fontFamilyH2" value="Arial" />
+ ... </browser:cssregistry>
+ ... </configure>""", context)
+
+`browser:cssregistry` diretive creates ICSSRegistry. It accepts name,title,layer
+parameters. All parameters not required, by default registry will have blank name
+and registered against IDefaultBrowserLayer layer. We can't register cssregistry
+for layer, because in that case it whould be available as resource (++resource++)
+So directive register multi adapter for ICSSRegistryLayer and supplied layer
+
+ >>> registry = component.getMultiAdapter((Layer, Layer, request), ICSSRegistry)
+ >>> verifyObject(ICSSRegistry, registry)
+ True
+
+ >>> registry['color1'].value
+ u'#f5f5f5'
+
+ >>> registry['fontFamilyH1'].value
+ u'Verdana'
+
+We also can add more properties later:
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:browser="http://namespaces.zope.org/browser">
+ ... <browser:cssproperty name="color3" value="#225593" />
+ ... </configure>""", context)
+
+ >>> registry['color3'].value
+ u'#225593'
+
+
+zrt command
+-----------
+
+z3ext.cssregistry package aslo register new command for z3c.zrtresource.
+
+ >>> from z3ext.cssregistry.command import cssregistry_factory
+ >>> from z3c.zrtresource.interfaces import IZRTCommandFactory
+
+ >>> component.provideUtility(cssregistry_factory, IZRTCommandFactory, 'cssregistry')
+
+Now we can use cssregistry for zrtresource resources
+
+ >>> import tempfile
+ >>> fn = tempfile.mktemp('.css')
+ >>> open(fn, 'w').write('''\
+ ... /* zrt-cssregistry: */
+ ... h1 {
+ ... color: color1;
+ ... font: fontFamilyH1;
+ ... }
+ ...
+ ... h2 {
+ ... color: color2;
+ ... font: fontFamilyH2;
+ ... }''')
+
+ >>> from z3c.zrtresource.zrtresource import ZRTFileResourceFactory
+ >>> cssFactory = ZRTFileResourceFactory(fn, None, 'site.css')
+
+ >>> from zope.publisher.browser import TestRequest
+ >>> css = cssFactory(TestRequest())
+
+ >>> print css.GET()
+ h1 {
+ color: #f5f5f5;
+ font: Verdana;
+ }
+ <BLANKLINE>
+ h2 {
+ color: white;
+ font: Arial;
+ }
+
+Now if we need change css file we only need change cssregistry properties
+
+ >>> registry['color1'].value = 'black'
+
+ >>> print css.GET()
+ h1 {
+ color: black;
+ font: Verdana;
+ }
+ <BLANKLINE>
+ h2 {
+ color: white;
+ font: Arial;
+ }
+
+We also can use named cssregistries
+
+ >>> context = xmlconfig.string("""
+ ... <configure xmlns:browser="http://namespaces.zope.org/browser">
+ ... <browser:cssregistry name="mycss">
+ ... <property name="color1" value="#d5d5d5" />
+ ... <property name="color2" value="black" />
+ ... <property name="fontFamilyH1" value="Tahoma" />
+ ... <property name="fontFamilyH2" value="Courier" />
+ ... </browser:cssregistry>
+ ... </configure>""", context)
+
+ >>> open(fn, 'w').write('''\
+ ... /* zrt-cssregistry: mycss */
+ ... h1 {
+ ... color: color1;
+ ... font: fontFamilyH1;
+ ... }
+ ...
+ ... h2 {
+ ... color: color2;
+ ... font: fontFamilyH2;
+ ... }''')
+
+ >>> print css.GET()
+ h1 {
+ color: #d5d5d5;
+ font: Tahoma;
+ }
+ <BLANKLINE>
+ h2 {
+ color: black;
+ font: Courier;
+ }
+
+If cssregistry is unknown nothing will happen
+
+ >>> open(fn, 'w').write('''\
+ ... /* zrt-cssregistry: unknown */
+ ... h1 {
+ ... color: color1;
+ ... font: fontFamilyH1;
+ ... }''')
+ >>> print css.GET()
+ h1 {
+ color: color1;
+ font: fontFamilyH1;
+ }
+
+
+Registry methods
+----------------
+
+ >>> registry.keys()
+ [u'color1', u'color3', u'color2', u'fontFamilyH2', u'fontFamilyH1']
+
+ >>> list(iter(registry))
+ [u'color1', u'color3', u'color2', u'fontFamilyH2', u'fontFamilyH1']
+
+ >>> for key, prop in registry.items():
+ ... print key, prop
+ color1 <z3ext.cssregistry.property.Property ...>
+ color3 <z3ext.cssregistry.property.Property ...>
+ color2 <z3ext.cssregistry.property.Property ...>
+ fontFamilyH2 <z3ext.cssregistry.property.Property ...>
+ fontFamilyH1 <z3ext.cssregistry.property.Property ...>
+
+ >>> len(registry)
+ 5
+
+ >>> u'color1' in registry
+ True
+
+ >>> registry.get(u'color1')
+ <z3ext.cssregistry.property.Property ...>
+
+ >>> del registry[u'color1']
+ >>> registry.keys()
+ [u'color3', u'color2', u'fontFamilyH2', u'fontFamilyH1']
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configlet.zcml
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/configlet.zcml 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configlet.zcml 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,39 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- xmlns:zcml="http://namespaces.zope.org/zcml"
- xmlns:z3ext="http://namespaces.zope.org/z3ext"
- xmlns:browser="http://namespaces.zope.org/browser"
- i18n_domain="z3ext">
-
- <zcml:configure zcml:condition="installed z3ext.controlpanel">
- <include package="z3ext.controlpanel" file="meta.zcml" />
-
- <z3ext:configlet
- name="ui.cssregistry"
- title="CSS Properties"
- description="CSS properties registry configuration."
- schema=".interfaces.ICSSRegistryConfiglet"
- class=".configlet.CSSRegistryConfiglet" />
-
- <adapter factory=".configlet.portalCssRegistry" />
-
- <class class=".configlet.CSSRegistryConfiglet">
- <require
- permission="zope.Public"
- attributes="name title"
- interface="zope.interface.common.mapping.IEnumerableMapping" />
- <require
- permission="z3ext.Configure"
- interface="zope.interface.common.mapping.IWriteMapping" />
- </class>
-
- <browser:page
- name="index.html"
- for=".interfaces.ICSSRegistryConfiglet"
- template="configletview.pt"
- class=".configletview.ViewRegistry"
- permission="z3ext.Configure" />
-
- </zcml:configure>
-
-</configure>
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configlet.zcml (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/configlet.zcml)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configlet.zcml (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configlet.zcml 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,37 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ xmlns:z3ext="http://namespaces.zope.org/z3ext"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ zcml:condition="installed z3ext.controlpanel"
+ i18n_domain="z3ext.cssregistry">
+
+ <include package="z3ext.controlpanel" file="meta.zcml" />
+
+ <z3ext:configlet
+ name="ui.cssregistry"
+ title="CSS Properties"
+ description="CSS properties registry configuration."
+ schema=".interfaces.ICSSRegistryConfiglet"
+ class=".configlet.CSSRegistryConfiglet" />
+
+ <adapter factory=".configlet.portalCssRegistry" />
+
+ <class class=".configlet.CSSRegistryConfiglet">
+ <require
+ permission="zope.Public"
+ attributes="name title"
+ interface="zope.interface.common.mapping.IEnumerableMapping" />
+ <require
+ permission="z3ext.Configure"
+ interface="zope.interface.common.mapping.IWriteMapping" />
+ </class>
+
+ <browser:page
+ name="index.html"
+ for=".interfaces.ICSSRegistryConfiglet"
+ template="configletview.pt"
+ class=".configletview.ViewRegistry"
+ permission="z3ext.Configure" />
+
+</configure>
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.pt
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/configletview.pt 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.pt 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,114 +0,0 @@
-<form method="post" action="@@index.html" class="z-form" i18n:domain="z3ext">
- <div class="topframe" tal:define="props context/keys">
- <h1 tal:content="context/__title__">Portal CSS properties</h1>
- <div class="pageDescription" tal:content="context/__description__"></div>
-
- <div class="z-field">
- <label i18n:translate="">Status</label>
- <div>
- <select name="form.enabled">
- <option value="yes"
- tal:attributes="selected context/enabled" i18n:translate="">
- Enabled
- </option>
- <option value="no"
- tal:attributes="selected not:context/enabled" i18n:translate="">
- Disabled
- </option>
- </select>
- </div>
- </div>
- <br />
-
- <tal:block tal:condition="props">
- <h2 i18n:translate="">Properties</h2>
-
- <table class="listing">
- <tr>
- <th> </th>
- <th i18n:translate="">Property</th>
- <th i18n:translate="">Value</th>
- </tr>
- <tr tal:repeat="prop props"
- tal:attributes="class python:repeat['prop'].even() and 'even' or 'odd'">
- <td><input type="checkbox" name="property:list"
- tal:attributes="value prop" /></td>
- <td tal:content="prop"></td>
- <td><input type="text"
- tal:attributes="name string:prop-$prop;
- value python:context[prop].value" /></td>
- </tr>
- </table>
- <div class="z-form-controls">
- <input type="submit" class="z-form-button"
- name="form.save" value="Save" i18n:attributes="value" />
- <input type="submit" class="z-form-removebutton"
- name="form.remove" value="Remove" i18n:attributes="value" />
- </div>
- </tal:block>
-
- <tal:block tal:condition="not:props" i18n:translate="">
- There are no any defined properties.
- </tal:block>
-
- <tal:block condition="nothing">
- <br /><br />
- <hr />
- <h3 i18n:translate="">Add property</h3>
- <div class="z-field">
- </div>
- <div>
- </div>
- <div class="z-form-controls">
- <input type="submit" class="z-form-addbutton"
- name="form.add" value="Add" i18n:attributes="value" />
- </div>
- </tal:block>
- </div>
-
- <div class="frame">
- <h2 i18n:translate="">Add property</h2>
-
- <div class="z-field">
- <label i18n:translate="">Property name</label>
-
- <div>
- <input type="text" name="form.add.name" />
- </div>
- </div>
-
- <div class="z-field">
- <label i18n:translate="">Value</label>
-
- <div>
- <input type="text" name="form.add.value" />
- </div>
- </div>
-
- <div class="z-form-controls">
- <input type="submit" class="z-form-addbutton"
- name="form.add" value="Add" i18n:attributes="value" />
- </div>
- </div>
-
- <div class="frame" tal:define="regs view/listRegistries" tal:condition="regs">
- <h2 i18n:translate="">Copy/Update properties from existent registries</h2>
- <div> </div>
-
- <div class="z-field">
- <label i18n:translate="">Registry</label>
- <div></div>
- <select name="registry:int">
- <option tal:repeat="reg regs"
- tal:attributes="value python:repeat['reg'].index()"
- tal:content="string:${reg/name} (${reg/layer})"></option>
- </select>
- </div>
- <div class="z-form-controls">
- <input type="submit" class="z-form-button" name="form.copy"
- value="Copy" i18n:attributes="value" />
- <input type="submit" class="z-form-standalonebtn" name="form.update"
- value="Update" i18n:attributes="value" />
- </div>
- </div>
-</form>
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.pt (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/configletview.pt)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.pt (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.pt 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,102 @@
+<form method="post" action="@@index.html" class="z-form"
+ i18n:domain="z3ext.cssregistry">
+ <div class="z-topframe" tal:define="props context/keys">
+ <h1 tal:content="context/__title__">Portal CSS properties</h1>
+ <div class="pageDescription" tal:content="context/__description__"></div>
+
+ <div class="z-form-field">
+ <label i18n:translate="">Status</label>
+ <div>
+ <select name="form.enabled">
+ <option value="yes"
+ tal:attributes="selected context/enabled" i18n:translate="">
+ Enabled
+ </option>
+ <option value="no"
+ tal:attributes="selected not:context/enabled" i18n:translate="">
+ Disabled
+ </option>
+ </select>
+ </div>
+ </div>
+ <br />
+
+ <tal:block tal:condition="props">
+ <h2 i18n:translate="">Properties</h2>
+
+ <table class="z-content-listing">
+ <tr>
+ <th> </th>
+ <th i18n:translate="">Property</th>
+ <th i18n:translate="">Value</th>
+ </tr>
+ <tr tal:repeat="prop props"
+ tal:attributes="class python:repeat['prop'].even() and 'even' or 'odd'">
+ <td><input type="checkbox" name="property:list"
+ tal:attributes="value prop" /></td>
+ <td tal:content="prop"></td>
+ <td><input type="text"
+ tal:attributes="name string:prop-$prop;
+ value python:context[prop].value" /></td>
+ </tr>
+ </table>
+ <div class="z-form-controls">
+ <input type="submit" class="z-form-savebutton"
+ name="form.save" value="Save" i18n:attributes="value" />
+ <input type="submit" class="z-form-removebutton"
+ name="form.remove" value="Remove" i18n:attributes="value" />
+ </div>
+ </tal:block>
+
+ <tal:block tal:condition="not:props" i18n:translate="">
+ There are no any defined properties.
+ </tal:block>
+ </div>
+
+ <div class="z-frame">
+ <h2 i18n:translate="">Add property</h2>
+
+ <div class="z-form-field">
+ <label i18n:translate="">Property name</label>
+
+ <div>
+ <input type="text" name="form.add.name" />
+ </div>
+ </div>
+
+ <div class="z-form-field">
+ <label i18n:translate="">Value</label>
+
+ <div>
+ <input type="text" name="form.add.value" />
+ </div>
+ </div>
+
+ <div class="z-form-controls">
+ <input type="submit" class="z-form-addbutton"
+ name="form.add" value="Add" i18n:attributes="value" />
+ </div>
+ </div>
+
+ <div class="z-frame"
+ tal:define="regs view/listRegistries" tal:condition="regs">
+ <h2 i18n:translate="">Copy/Update properties from existent registries</h2>
+ <div> </div>
+
+ <div class="z-form-field">
+ <label i18n:translate="">Registry</label>
+ <div></div>
+ <select name="registry:int">
+ <option tal:repeat="reg regs"
+ tal:attributes="value python:repeat['reg'].index()"
+ tal:content="string:${reg/name} (${reg/layer})"></option>
+ </select>
+ </div>
+ <div class="z-form-controls">
+ <input type="submit" class="z-form-button" name="form.copy"
+ value="Copy" i18n:attributes="value" />
+ <!--input type="submit" class="z-form-standalonebtn" name="form.update"
+ value="Update" i18n:attributes="value" /-->
+ </div>
+ </div>
+</form>
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.py
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/configletview.py 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,86 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-""" `browser:cssregistry` directive
-
-$Id$
-"""
-from zope import interface
-from z3ext.layout.pagelet import BrowserPagelet
-from z3ext.statusmessage.interfaces import IStatusMessage
-
-from z3ext.cssregistry.i18n import _
-from z3ext.cssregistry.registry import registries
-from z3ext.cssregistry.property import CSSProperty
-from z3ext.cssregistry.interfaces import ICSSRegistry
-
-
-class ViewRegistry(BrowserPagelet):
-
- def listRegistries(self):
- regs = []
- for key, registry in registries.items():
- name, layer = key
-
- regs.append({'name': name or 'Without name',
- 'layer': '%s.%s'%(layer.__module__, layer.__name__),
- 'registry': registry})
-
- return regs
-
- def update(self):
- request = self.request
-
- if 'form.copy' in request:
- reg = request.get('registry', None)
-
- try:
- registry = self.listRegistries()[int(reg)]['registry']
-
- for prop, value in registry.items():
- self.context[prop] = value
-
- IStatusMessage(request).add(
- _(u"CSS Registry has been copied."))
- except:
- pass
-
- if 'form.add' in request:
- name = request.get('form.add.name', '').strip()
- if not name:
- IStatusMessage(request).add(
- _(u"Can't add property with emtpy name."), 'error')
- else:
- self.context[name] = CSSProperty(
- name, request.get('form.add.value', ''))
-
- if 'form.remove' in request:
- for prop in request.get('property', ()):
- del self.context[prop]
- IStatusMessage(request).add(_(u"Properties have been removed."))
-
- if 'form.save' in request:
-
- for key, value in request.form.items():
- if key.startswith('prop-'):
- key = key[5:]
- self.context[key].value = value
-
- if request.get('form.enabled') == 'yes':
- self.context.enabled = True
- else:
- self.context.enabled = False
-
- IStatusMessage(request).add(_(u"Properties have been changed."))
-
- return self.index()
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.py (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/configletview.py)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.py (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configletview.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,86 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+""" `browser:cssregistry` directive
+
+$Id$
+"""
+from zope import interface
+from z3ext.layout.pagelet import BrowserPagelet
+from z3ext.statusmessage.interfaces import IStatusMessage
+
+from z3ext.cssregistry.property import Property
+from z3ext.cssregistry.registry import registries
+from z3ext.cssregistry.interfaces import _, ICSSRegistry
+
+
+class ViewRegistry(BrowserPagelet):
+
+ def listRegistries(self):
+ regs = []
+ for key, registry in registries.items():
+ name, layer = key
+
+ regs.append({'name': name or _('Without name'),
+ 'layer': '%s.%s'%(layer.__module__, layer.__name__),
+ 'registry': registry})
+
+ return regs
+
+ def update(self):
+ request = self.request
+
+ if 'form.copy' in request:
+ reg = request.get('registry', None)
+
+ registry = self.listRegistries()[int(reg)]['registry']
+
+ for prop, value in registry.items():
+ self.context[prop] = value
+
+ IStatusMessage(request).add(
+ _(u"CSS Registry has been copied."))
+
+ if 'form.add' in request:
+ name = request.get('form.add.name', '').strip()
+ if not name:
+ IStatusMessage(request).add(
+ _(u"Can't add property with emtpy name."), 'error')
+ else:
+ self.context[name] = Property(
+ name, request.get('form.add.value', ''))
+
+ if 'form.remove' in request:
+ for prop in request.get('property', ()):
+ del self.context[prop]
+ IStatusMessage(request).add(_(u"Properties have been removed."))
+
+ if 'form.save' in request:
+ for key, value in request.form.items():
+ if key.startswith('prop-'):
+ key = key[5:]
+ old = self.context[key]
+ property = Property(
+ old.name, value, old.description, old.type)
+
+ self.context[key] = property
+
+ if request.get('form.enabled') == 'yes':
+ self.context.enabled = True
+ else:
+ self.context.enabled = False
+
+ IStatusMessage(request).add(_(u"Properties have been changed."))
+
+ return self.index()
+
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configure.zcml
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/configure.zcml 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configure.zcml 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,29 +0,0 @@
-<configure
- xmlns="http://namespaces.zope.org/zope"
- i18n_domain="z3ext">
-
- <utility
- name="cssregistry"
- provides="z3c.zrtresource.interfaces.IZRTCommandFactory"
- component=".command.cssregistry_factory" />
-
- <class class=".registry.CSSRegistry">
- <require
- permission="zope.Public"
- attributes="name title"
- interface="zope.interface.common.mapping.IEnumerableMapping" />
- </class>
-
- <class class=".property.CSSProperty">
- <require
- permission="zope.Public"
- interface=".interfaces.ICSSProperty" />
-
- <require
- permission="zope.Public"
- set_schema=".interfaces.ICSSProperty" />
- </class>
-
- <include file="configlet.zcml" />
-
-</configure>
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configure.zcml (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/configure.zcml)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configure.zcml (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/configure.zcml 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,87 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="z3ext.cssregistry">
+
+ <includeDependencies package="." />
+
+ <utility
+ name="cssregistry"
+ provides="z3c.zrtresource.interfaces.IZRTCommandFactory"
+ component=".command.cssregistry_factory" />
+
+ <class class=".registry.CSSRegistry">
+ <require
+ permission="zope.Public"
+ attributes="name title"
+ interface="zope.interface.common.mapping.IEnumerableMapping" />
+ </class>
+
+ <class class=".property.Property">
+ <require
+ permission="zope.Public"
+ interface=".interfaces.ICSSProperty" />
+ <require
+ permission="zope.Public"
+ set_schema=".interfaces.ICSSProperty" />
+ </class>
+
+ <class class=".property.CSSProperty">
+ <require
+ permission="zope.Public"
+ interface=".interfaces.ICSSProperty" />
+ <require
+ permission="zope.Public"
+ set_schema=".interfaces.ICSSProperty" />
+ </class>
+
+ <!-- default proeprties -->
+ <browser:cssregistry title="Default css properties">
+ <property name="backgroundColor" value="#F8F8F8" />
+ <property name="contentBackgroundColor" value="white" />
+
+ <property name="fontFamily"
+ value="Verdana, Tahoma, Helvetica, Arial, sans-serif" />
+ <property name="headingFontFamily"
+ value="Verdana, Tahoma, Helvetica, Arial, sans-serif" />
+ <property name="monospaceFontFamily"
+ value="Monaco, 'Courier New', Courier, monospace" />
+
+ <property name="fontColor" value="#252525" />
+ <property name="fontBaseSize" value="70%" />
+ <property name="fontSmallSize" value="90%" />
+
+ <property name="linkColor" value="#003C75"/>
+ <property name="linkActiveColor" value="Red" />
+ <property name="linkVisitedColor" value="Purple" />
+
+ <property name="borderWidth" value="1px" />
+ <property name="borderStyle" value="solid" />
+ <property name="borderStyleAnnotations" value="solid" />
+
+ <property name="globalFontColor" value="#71A0CD" />
+ <property name="globalBorderColor" value="#B0C7DD" />
+ <property name="globalBackgroundColor" value="#E2EFFC" />
+ <property name="globalExtraColor" value="#6088AE" />
+ <property name="globalExtraBorderColor" value="#6088AE" />
+
+ <property name="discreetColor" value="#76797C" />
+
+ <property name="contentViewBorderColor" value="#A5A5A5" />
+ <property name="contentViewBackgroundColor" value="#E4E4E4" />
+ <property name="contentViewFontColor" value="#898989" />
+
+ <property name="inputFontColor" value="#252525" />
+
+ <property name="textTransform" value="lowercase" />
+
+ <property name="evenRowBackgroundColor" value="#F3F7FD" />
+ <property name="oddRowBackgroundColor" value="transparent" />
+
+ <property name="notifyBorderColor" value="#ffa500" />
+ <property name="notifyBackgroundColor" value="#ffce7b" />
+ </browser:cssregistry>
+
+ <include file="configlet.zcml" />
+
+</configure>
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/i18n.py
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/i18n.py 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/i18n.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,19 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-""" i18n
-
-$Id$
-"""
-from zope.i18nmessageid import MessageFactory
-_ = MessageFactory('z3ext')
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/interfaces.py
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/interfaces.py 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/interfaces.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,83 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-""" z3ext.cssregistry interfaces
-
-$Id$
-"""
-from zope import schema, interface
-from zope.interface.common.mapping import IMapping
-
-from z3ext.cssregistry.i18n import _
-
-
-class ICSSRegistry(IMapping):
-
- properties = interface.Attribute('css properties')
-
- name = schema.TextLine(
- title = _(u'Name'),
- description = _(u'CSS Registry name'),
- default = u'',
- required = False)
-
- title = schema.TextLine(
- title = _(u'Title'),
- description = _(u'CSS Registry title'),
- default = u'',
- required = False)
-
-
-class ICSSProperty(interface.Interface):
-
- name = schema.TextLine(
- title = _(u'Name'),
- description = _(u'Property name'),
- required = True)
-
- description = schema.TextLine(
- title = _(u'Description'),
- description = _(u'Property description'),
- required = False)
-
- value = schema.TextLine(
- title = _(u'Value'),
- description = _(u'Property value'),
- required = True)
-
- type = schema.TextLine(
- title = _(u'Type'),
- description = _(u'Property type. (color, font, size)'),
- required = False)
-
- def process(text):
- """ replace property in text """
-
-
-class ICSSRegistryLayer(interface.Interface):
- """ marker interface """
-
-
-class Layer(object):
- interface.implements(ICSSRegistryLayer)
-
-Layer = Layer()
-
-
-class ICSSRegistryConfiglet(ICSSRegistry):
- """ css registry configlet """
-
- enabled = schema.Bool(
- title = _(u'Enabled'),
- default = False,
- required = True)
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/interfaces.py (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/interfaces.py)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/interfaces.py (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/interfaces.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,84 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+""" z3ext.cssregistry interfaces
+
+$Id$
+"""
+from zope import schema, interface
+from zope.interface.common.mapping import IMapping
+from zope.i18nmessageid import MessageFactory
+
+_ = MessageFactory('z3ext.cssregistry')
+
+
+class ICSSRegistry(IMapping):
+
+ properties = interface.Attribute('css properties')
+
+ name = schema.TextLine(
+ title = _(u'Name'),
+ description = _(u'CSS Registry name'),
+ default = u'',
+ required = False)
+
+ title = schema.TextLine(
+ title = _(u'Title'),
+ description = _(u'CSS Registry title'),
+ default = u'',
+ required = False)
+
+
+class ICSSProperty(interface.Interface):
+
+ name = schema.TextLine(
+ title = _(u'Name'),
+ description = _(u'Property name'),
+ required = True)
+
+ description = schema.TextLine(
+ title = _(u'Description'),
+ description = _(u'Property description'),
+ required = False)
+
+ value = schema.TextLine(
+ title = _(u'Value'),
+ description = _(u'Property value'),
+ required = True)
+
+ type = schema.TextLine(
+ title = _(u'Type'),
+ description = _(u'Property type. (color, font, size)'),
+ required = False)
+
+ def process(text):
+ """ replace property in text """
+
+
+class ICSSRegistryLayer(interface.Interface):
+ """ marker interface """
+
+
+class Layer(object):
+ interface.implements(ICSSRegistryLayer)
+
+Layer = Layer()
+
+
+class ICSSRegistryConfiglet(ICSSRegistry):
+ """ css registry configlet """
+
+ enabled = schema.Bool(
+ title = _(u'Enabled'),
+ default = False,
+ required = True)
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/locales (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/locales)
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/property.py
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/property.py 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/property.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,36 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-""" ICSSProperty implementation
-
-$Id$
-"""
-import re
-from zope import interface
-from persistent import Persistent
-
-from interfaces import ICSSProperty
-
-
-class CSSProperty(Persistent):
- interface.implements(ICSSProperty)
-
- def __init__(self, name, value, description='', type=''):
- self.name = name
- self.value = value
- self.description = description
- self.type = type
-
- def process(self, text):
- regex = re.compile(re.escape(self.name))
- return regex.subn(self.value, text)[0]
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/property.py (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/property.py)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/property.py (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/property.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,40 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+""" ICSSProperty implementation
+
+$Id$
+"""
+import re
+from zope import interface
+from persistent import Persistent
+
+from interfaces import ICSSProperty
+
+
+class Property(object):
+ interface.implements(ICSSProperty)
+
+ def __init__(self, name, value, description='', type=''):
+ self.name = name
+ self.value = value
+ self.description = description
+ self.type = type
+
+ def process(self, text):
+ regex = re.compile(re.escape(self.name))
+ return regex.subn(self.value, text)[0]
+
+
+class CSSProperty(Property, Persistent):
+ pass
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/registry.py
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/registry.py 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/registry.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,64 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-"""
-
-$Id$
-"""
-from zope import interface
-from persistent import Persistent
-from interfaces import ICSSRegistry
-
-registries = {}
-
-
-class CSSRegistry(Persistent):
- interface.implements(ICSSRegistry)
-
- @property
- def properties(self):
- try:
- return self._properties
- except AttributeError:
- self._properties = {}
- return self._properties
-
- def keys(self):
- return self.properties.keys()
-
- def __iter__(self):
- return iter(self.properties)
-
- def values(self):
- return self.properties.values()
-
- def items(self):
- return self.properties.items()
-
- def __len__(self):
- return len(self.properties)
-
- def __setitem__(self, key, value):
- self.properties[key] = value
-
- def __getitem__(self, key):
- return self.properties[key]
-
- def __delitem__(self, key):
- del self.properties[key]
-
- def get(self, key, default=None):
- return self.properties.get(key, default)
-
- def __contains__(self, key):
- return key in self.properties
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/registry.py (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/registry.py)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/registry.py (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/registry.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,63 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+from zope import interface
+from interfaces import ICSSRegistry
+
+registries = {}
+
+
+class CSSRegistry(object):
+ interface.implements(ICSSRegistry)
+
+ @property
+ def properties(self):
+ try:
+ return self._properties
+ except AttributeError:
+ self._properties = {}
+ return self._properties
+
+ def keys(self):
+ return self.properties.keys()
+
+ def __iter__(self):
+ return iter(self.properties)
+
+ def values(self):
+ return self.properties.values()
+
+ def items(self):
+ return self.properties.items()
+
+ def __len__(self):
+ return len(self.properties)
+
+ def __setitem__(self, key, value):
+ self.properties[key] = value
+
+ def __getitem__(self, key):
+ return self.properties[key]
+
+ def __delitem__(self, key):
+ del self.properties[key]
+
+ def get(self, key, default=None):
+ return self.properties.get(key, default)
+
+ def __contains__(self, key):
+ return key in self.properties
Deleted: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/zcml.py
===================================================================
--- z3ext.cssregistry/trunk/src/z3ext/cssregistry/zcml.py 2008-10-08 14:40:41 UTC (rev 91907)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/zcml.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -1,136 +0,0 @@
-##############################################################################
-#
-# 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.
-#
-##############################################################################
-""" `browser:cssregistry` directive
-
-$Id$
-"""
-
-from zope import schema, interface
-from zope.component.zcml import handler
-from zope.configuration.fields import GlobalObject
-
-from i18n import _
-from property import CSSProperty
-from registry import CSSRegistry, registries
-
-from interfaces import ICSSRegistry, ICSSRegistryLayer
-
-
-class ICSSRegistryDirective(interface.Interface):
-
- name = schema.TextLine(
- title = _(u'Name'),
- description = _(u'Registry name'),
- required = False)
-
- title = schema.TextLine(
- title = _(u'Title'),
- required = False)
-
- layer = GlobalObject(
- title=_(u"The layer the css registry should be found in"),
- required=False)
-
-
-class ICSSPropertySubDirective(interface.Interface):
-
- name = schema.TextLine(
- title = _(u'Name'),
- description = _(u'Property name'),
- required = True)
-
- value = schema.TextLine(
- title = _(u'Value'),
- description = _(u'Property value'),
- required = True)
-
- description = schema.TextLine(
- title = _(u'Description'),
- description = _(u'Property description'),
- required = False)
-
- type = schema.TextLine(
- title = _(u'Type'),
- description = _(u'Property type. (color, font, size)'),
- required = False)
-
-
-class ICSSPropertyDirective(interface.Interface):
-
- registry = schema.TextLine(
- title = _(u'Registry'),
- required = False)
-
- layer = GlobalObject(
- title = _(u"The layer the css registry should be found in"),
- required=False)
-
- name = schema.TextLine(
- title = _(u'Name'),
- required = True)
-
- value = schema.TextLine(
- title = _(u'Value'),
- required = True)
-
- description = schema.TextLine(
- title = _(u'Description'),
- description = _(u'Property description'),
- required = False)
-
- type = schema.TextLine(
- title = _(u'Type'),
- description = _(u'Property type. (color, font, size)'),
- required = False)
-
-
-class Factory(object):
-
- def __init__(self, registry):
- self.registry = registry
-
- def __call__(self, layer1, layer2, request):
- return self.registry
-
-
-class cssregistryHandler(object):
-
- def __init__(self, _context, name='', title='', layer=interface.Interface):
- self.name = name
- self.layer = layer
-
- self.registry = CSSRegistry()
- self.registry.name = name
- self.registry.title = title
-
- registries[(name, layer)] = self.registry
-
- # we can't use just 'layer', because registry will be registered as resource
- _context.action(
- discriminator = ('CSSRegistry', name, layer),
- callable = handler,
- args = ('registerAdapter',
- Factory(self.registry),
- (ICSSRegistryLayer, ICSSRegistryLayer, layer),
- ICSSRegistry, name, _context.info),
- )
-
- def property(self, _context, name, value, description='', type=''):
- self.registry[name] = CSSProperty(name, value, description, type)
-
-
-def csspropertyHandler(_context, name, value, registry='',
- layer=interface.Interface, description='', type=''):
- registry = registries[(registry, layer)]
- registry[name] = CSSProperty(name, value, description, type)
Copied: z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/zcml.py (from rev 91920, z3ext.cssregistry/trunk/src/z3ext/cssregistry/zcml.py)
===================================================================
--- z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/zcml.py (rev 0)
+++ z3ext.cssregistry/tags/1.3.0/src/z3ext/cssregistry/zcml.py 2008-10-09 16:23:43 UTC (rev 91921)
@@ -0,0 +1,135 @@
+##############################################################################
+#
+# 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.
+#
+##############################################################################
+""" `browser:cssregistry` directive
+
+$Id$
+"""
+
+from zope import schema, interface
+from zope.component.zcml import handler
+from zope.configuration.fields import GlobalObject
+
+from property import Property
+from registry import CSSRegistry, registries
+
+from interfaces import _, ICSSRegistry, ICSSRegistryLayer
+
+
+class ICSSRegistryDirective(interface.Interface):
+
+ name = schema.TextLine(
+ title = u'Name',
+ description = u'Registry name',
+ required = False)
+
+ title = schema.TextLine(
+ title = u'Title',
+ required = False)
+
+ layer = GlobalObject(
+ title = u"The layer the css registry should be found in",
+ required = False)
+
+
+class ICSSPropertySubDirective(interface.Interface):
+
+ name = schema.TextLine(
+ title = u'Name',
+ description = u'Property name',
+ required = True)
+
+ value = schema.TextLine(
+ title = u'Value',
+ description = u'Property value',
+ required = True)
+
+ description = schema.TextLine(
+ title = u'Description',
+ description = u'Property description',
+ required = False)
+
+ type = schema.TextLine(
+ title = u'Type',
+ description = u'Property type. (color, font, size)',
+ required = False)
+
+
+class ICSSPropertyDirective(interface.Interface):
+
+ registry = schema.TextLine(
+ title = u'Registry',
+ required = False)
+
+ layer = GlobalObject(
+ title = u"The layer the css registry should be found in",
+ required=False)
+
+ name = schema.TextLine(
+ title = u'Name',
+ required = True)
+
+ value = schema.TextLine(
+ title = u'Value',
+ required = True)
+
+ description = schema.TextLine(
+ title = u'Description',
+ description = u'Property description',
+ required = False)
+
+ type = schema.TextLine(
+ title = u'Type',
+ description = u'Property type. (color, font, size)',
+ required = False)
+
+
+class Factory(object):
+
+ def __init__(self, registry):
+ self.registry = registry
+
+ def __call__(self, layer1, layer2, request):
+ return self.registry
+
+
+class cssregistryHandler(object):
+
+ def __init__(self, _context, name='', title='', layer=interface.Interface):
+ self.name = name
+ self.layer = layer
+
+ self.registry = CSSRegistry()
+ self.registry.name = name
+ self.registry.title = title
+
+ registries[(name, layer)] = self.registry
+
+ # we can't use just 'layer', because registry will be registered as resource
+ _context.action(
+ discriminator = ('CSSRegistry', name, layer),
+ callable = handler,
+ args = ('registerAdapter',
+ Factory(self.registry),
+ (ICSSRegistryLayer, ICSSRegistryLayer, layer),
+ ICSSRegistry, name, _context.info),
+ )
+
+ def property(self, _context, name, value, description='', type=''):
+ self.registry[name] = Property(name, value, description, type)
+
+
+def csspropertyHandler(_context, name, value, registry='',
+ layer=interface.Interface, description='', type=''):
+ registry = registries[(registry, layer)]
+ registry[name] = Property(name, value, description, type)
More information about the Checkins
mailing list