[Checkins] SVN: z3ext.controlpanel/trunk/ - Added default stylesheets
Nikolay Kim
fafhrd at datacom.kz
Tue Oct 7 09:25:18 EDT 2008
Log message for revision 91845:
- Added default stylesheets
- Configlet data storage api has been refactored.
- Use z3ext.controlpanel i18n domain
Changed:
U z3ext.controlpanel/trunk/CHANGES.txt
U z3ext.controlpanel/trunk/buildout.cfg
A z3ext.controlpanel/trunk/scripts/
A z3ext.controlpanel/trunk/scripts/i18nall.in
A z3ext.controlpanel/trunk/scripts/i18ncheck.in
U z3ext.controlpanel/trunk/setup.py
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/README.txt
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/category.pt
D z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/configlet.pt
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/configure.zcml
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/layout.pt
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/navigation.pt
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/styles.css
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/configlet.py
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/configlettype.py
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/configure.zcml
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/__init__.py
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/install.py
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/interfaces.py
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/LC_MESSAGES/
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/LC_MESSAGES/z3ext.controlpanel.mo
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/LC_MESSAGES/z3ext.controlpanel.po
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/z3ext.controlpanel.pot
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/root.py
A z3ext.controlpanel/trunk/src/z3ext/controlpanel/site.txt
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/storage.py
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/testing.py
U z3ext.controlpanel/trunk/src/z3ext/controlpanel/tests.py
-=-
Modified: z3ext.controlpanel/trunk/CHANGES.txt
===================================================================
--- z3ext.controlpanel/trunk/CHANGES.txt 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/CHANGES.txt 2008-10-07 13:25:17 UTC (rev 91845)
@@ -2,12 +2,16 @@
CHANGES
=======
-1.2.7 (Unreleased)
+1.3.0 (2008-10-07)
------------------
-- Added `settings` traverser
+- Added default stylesheets
+- Configlet data storage api has been refactored.
+- Use z3ext.controlpanel i18n domain
+
+
1.2.6 (2008-08-28)
------------------
Modified: z3ext.controlpanel/trunk/buildout.cfg
===================================================================
--- z3ext.controlpanel/trunk/buildout.cfg 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/buildout.cfg 2008-10-07 13:25:17 UTC (rev 91845)
@@ -1,6 +1,7 @@
[buildout]
develop = .
-parts = test coverage-test coverage-report
+parts = test coverage-test coverage-report
+ i18n- i18nall i18ncheck i18ndude
[test]
recipe = zc.recipe.testrunner
@@ -16,3 +17,44 @@
eggs = z3c.coverage
scripts = coverage=coverage-report
arguments = ('coverage', 'coverage/report')
+
+[i18n-]
+recipe = z3c.recipe.i18n:i18n
+packages = z3ext.controlpanel
+domain = z3ext.controlpanel
+output = ${buildout:directory}/src/z3ext/controlpanel/locales
+eggs = z3ext.controlpanel [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.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.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.controlpanel" file="meta.zcml" />
+ <include package="z3ext.controlpanel" />
+ </configure>
+
+[i18nall]
+recipe = buildout_script
+template_dir = ${buildout:directory}/scripts
+template = i18nall.in
+
+[i18ncheck]
+recipe = buildout_script
+template_dir = ${buildout:directory}/scripts
+template = i18ncheck.in
+
+[i18ndude]
+unzip = true
+recipe = zc.recipe.egg
+eggs = i18ndude
Added: z3ext.controlpanel/trunk/scripts/i18nall.in
===================================================================
--- z3ext.controlpanel/trunk/scripts/i18nall.in (rev 0)
+++ z3ext.controlpanel/trunk/scripts/i18nall.in 2008-10-07 13:25:17 UTC (rev 91845)
@@ -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/controlpanel z3ext && \
Property changes on: z3ext.controlpanel/trunk/scripts/i18nall.in
___________________________________________________________________
Name: svn:executable
+ *
Added: z3ext.controlpanel/trunk/scripts/i18ncheck.in
===================================================================
--- z3ext.controlpanel/trunk/scripts/i18ncheck.in (rev 0)
+++ z3ext.controlpanel/trunk/scripts/i18ncheck.in 2008-10-07 13:25:17 UTC (rev 91845)
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Startup or shutdown buildbot
+
+bin/i18ndude find-untranslated ./ | grep z3ext.controlpanel | less
Property changes on: z3ext.controlpanel/trunk/scripts/i18ncheck.in
___________________________________________________________________
Name: svn:executable
+ *
Modified: z3ext.controlpanel/trunk/setup.py
===================================================================
--- z3ext.controlpanel/trunk/setup.py 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/setup.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -21,7 +21,7 @@
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
-version='1.2.7dev'
+version='1.3.0dev'
setup(name = 'z3ext.controlpanel',
@@ -52,8 +52,7 @@
packages=find_packages('src'),
package_dir = {'':'src'},
namespace_packages=['z3ext'],
- install_requires = ['setuptools',
- 'ZODB3',
+ install_requires = ['setuptools', 'ZODB3',
'zope.schema',
'zope.interface',
'zope.component',
@@ -61,24 +60,29 @@
'zope.security',
'zope.location',
'zope.publisher',
+ 'zope.i18n',
'zope.i18nmessageid',
'zope.viewlet',
'zope.contentprovider',
'zope.cachedescriptors',
'zope.lifecycleevent',
+ 'zope.configuration',
'zope.app.publisher',
'zope.app.component',
'zope.app.security',
- 'zope.configuration',
+ 'zope.app.container',
+ 'zc.copy',
'z3c.traverser',
'z3c.autoinclude',
'z3ext.layout',
'z3ext.layoutform',
+ 'z3ext.resourcepackage',
],
extras_require = dict(test=['zope.securitypolicy',
'zope.app.security',
'zope.app.testing',
'zope.app.zcmlfiles',
+ 'zope.app.folder',
'zope.traversing',
'zope.testing',
'zope.testbrowser',
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/README.txt
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/README.txt 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/README.txt 2008-10-07 13:25:17 UTC (rev 91845)
@@ -196,8 +196,8 @@
... </configure>""", context)
-Custom class implementation
----------------------------
+Custom configlet implementation
+-------------------------------
We can use custom configlet implementation
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/category.pt
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/category.pt 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/category.pt 2008-10-07 13:25:17 UTC (rev 91845)
@@ -1,18 +1,20 @@
-<div class="topframe" tal:define="configlets view/data" i18n:domain="z3ext">
- <h1 tal:content="context/__title__">Configlet category</h1>
- <div class="pageDescription"
+<div class="z-cp-frame" tal:define="configlets view/data"
+ i18n:domain="z3ext.controlpanel">
+ <h1 class="z-cp-title"
+ tal:content="context/__title__">Configlet category</h1>
+ <div class="z-cp-description"
tal:content="context/__description__">Description</div>
<div tal:condition="not:configlets" i18n:translate="">
There are no configlets in this category.
</div>
- <ul class="listing" tal:condition="configlets" metal:define-macro="configlets">
+ <ul class="z-cp-listing" tal:condition="configlets" metal:define-macro="configlets">
<li tal:repeat="configlet configlets">
- <div class="icon">
+ <div class="z-cp-icon">
<tal:block tal:content="structure configlet/icon|nothing" />
</div>
- <div class="details">
+ <div class="z-cp-details">
<a tal:attributes="href string:${configlet/configlet/@@absolute_url}/"
tal:content="configlet/title"></a>
<div><tal:block tal:content="configlet/description" /> </div>
Deleted: z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/configlet.pt
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/configlet.pt 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/configlet.pt 2008-10-07 13:25:17 UTC (rev 91845)
@@ -1,25 +0,0 @@
-<div class="topframe">
- <form method="post" class="edit-form" enctype="multipart/form-data"
- tal:attributes="action request/URL">
- <h1 tal:content="view/label|nothing">Do something</h1>
- <div class="discreet" tal:content="view/description|nothing"></div>
- <br />
-
- <div class="fieldset">
- <div>
- <tal:block tal:repeat="widget view/widgets">
- <metal:block use-macro="context/@@form_macros/widget_row"/>
- </tal:block>
- </div>
- </div>
-
- <div id="formControls">
- <hr />
- <span class="actionButtons"
- tal:condition="view/availableActions">
- <input tal:repeat="action view/actions"
- tal:replace="structure action/render" />
- </span>
- </div>
- </form>
-</div>
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/configure.zcml
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/configure.zcml 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/configure.zcml 2008-10-07 13:25:17 UTC (rev 91845)
@@ -3,7 +3,7 @@
xmlns:zcml="http://namespaces.zope.org/zcml"
xmlns:z3ext="http://namespaces.zope.org/z3ext"
xmlns:browser="http://namespaces.zope.org/browser"
- i18n_domain="z3ext">
+ i18n_domain="z3ext.controlpanel">
<z3ext:layout
layout="portal"
@@ -69,4 +69,11 @@
zcml:condition="installed z3c.breadcrumb"
factory=".breadcrumb.ConfigletBreadcrumb" />
+ <!-- css styles -->
+ <z3ext:resourceinclude
+ name="z3ext-controlpanel.css"
+ library="z3ext"
+ type="stylesheet"
+ file="styles.css" filetype="zrt" />
+
</configure>
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/layout.pt
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/layout.pt 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/layout.pt 2008-10-07 13:25:17 UTC (rev 91845)
@@ -1,14 +1,12 @@
-<div id="z-portal-workspace"
+<div id="z-controlpanel"
tal:define="context nocall:maincontext;
nav provider:z3ext.controlpanel-navigation;
noNav not:nav; rendered view/render">
- <div class="page">
- <table class="wide" tal:omit-tag="noNav">
- <tr style="vertical-align: top" tal:omit-tag="noNav">
- <td style="padding-right: 1em; width: 200px"
- tal:condition="nav" tal:content="structure nav"></td>
- <td tal:omit-tag="noNav" tal:content="structure rendered"></td>
- </tr>
- </table>
- </div>
+ <table class="z-cp-layout" tal:omit-tag="noNav">
+ <tr tal:omit-tag="noNav">
+ <td class="z-cp-nav-wrapper"
+ tal:condition="nav" tal:content="structure nav"></td>
+ <td tal:omit-tag="noNav" tal:content="structure rendered"></td>
+ </tr>
+ </table>
</div>
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/navigation.pt
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/navigation.pt 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/navigation.pt 2008-10-07 13:25:17 UTC (rev 91845)
@@ -1,16 +1,16 @@
<tal:block tal:repeat="viewlet view/viewlets"
tal:content="structure viewlet/render" />
-<div class="x-listing box small">
+<div class="z-cp-nav">
<tal:block tal:repeat="item view/data">
<metal:block metal:define-macro="level">
- <div class="x-listing-item"
- tal:attributes="class python:item['selected'] and 'x-listing-item-selected'
- or 'x-listing-item'">
+ <div class="z-cp-nav-item"
+ tal:attributes="class python:item['selected'] and 'z-cp-nav-item-selected'
+ or 'z-cp-nav-item'">
<div tal:omit-tag="not:item/level|nothing"
- tal:attributes="class string:level${item/level|nothing}">
+ tal:attributes="class string:z-cp-level${item/level|nothing}">
<a tal:attributes="href string:${item/configlet/@@absolute_url}/">
- <al:block tal:content="structure item/icon" />
+ <tal:block tal:content="structure item/icon" />
<tal:block tal:content="item/title" />
</a>
</div>
Added: z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/styles.css
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/styles.css (rev 0)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/browser/styles.css 2008-10-07 13:25:17 UTC (rev 91845)
@@ -0,0 +1,170 @@
+/* zrt-cssregistry: */
+
+ at media all {
+
+ #z-controlpanel {
+ padding: 1.5em;
+ border: borderWidth borderStyle globalBorderColor;
+ background-color: globalBackgroundColor;
+ margin: 2em 1.5em 1.5em 1.5em;
+ font-size: 110%;
+ }
+
+ #z-controlpanel h1 {
+ font-weight: bold;
+ }
+
+ #z-controlpanel .z-cp-description {
+ margin-bottom: 1em;
+ }
+
+ #z-controlpanel table.z-cp-layout {
+ width: 100%;
+ }
+
+ #z-controlpanel table.z-cp-layout tr {
+ vertical-align: top;
+ }
+
+ #z-controlpanel .z-cp-frame {
+ padding: 1em;
+ border: borderWidth borderStyle globalExtraBorderColor;
+ background: contentBackgroundColor;
+ }
+
+ #z-controlpanel .z-cp-nav-wrapper {
+ padding-right: 1em;
+ width: 200px;
+ }
+
+ #z-controlpanel .z-cp-nav {
+ border: borderWidth borderStyle globalBorderColor;
+ border-bottom: none;
+ background: contentBackgroundColor;
+ font-size: fontSmallSize;
+ }
+
+ #z-controlpanel .z-cp-nav a {
+ text-decoration: none;
+ }
+
+ #z-controlpanel .z-cp-nav-item {
+ padding: 0.8em 0.4em 0.5em 0.4em;
+ border-bottom: borderWidth borderStyle globalBorderColor;
+ }
+
+ #z-controlpanel .z-cp-nav-item-selected {
+ padding: 0.8em 0.4em 0.5em 0.4em;
+ background-color: globalBackgroundColor;
+ border-bottom: borderWidth borderStyle globalBorderColor;
+ }
+
+ #z-controlpanel .z-cp-nav-item:hover {
+ background-color: globalBackgroundColor;
+ }
+
+ #z-controlpanel .z-cp-nav-item li span {
+ border: 0;
+ border-bottom: 1px dotted discreetColor;
+ }
+
+
+ ul.z-cp-listing {
+ margin: 0.5em 0;
+ list-style: none;
+ list-style-image: none;
+ list-style-type: none;
+ }
+
+ ul.z-cp-listing li {
+ clear: both;
+ margin-bottom: 0.5em;
+ list-style: none;
+ list-style-image: none;
+ }
+
+ ul.z-cp-listing li .z-cp-icon {
+ float: left;
+ padding-top: 8px;
+ padding-right: 0.5em;
+ height: 32px;
+ }
+
+ ul.z-cp-listing li a,
+ ul.z-cp-listing li .z-cp-details a {
+ color: linkColor;
+ border: 0;
+ border-bottom: 1px dotted discreetColor;
+ text-decoration: none;
+ }
+
+ ul.z-cp-listing li a:visited,
+ ul.z-cp-listing li .z-cp-details a:visited {
+ color: linkColor;
+ background-color: transparent;
+ }
+
+ ul.z-cp-listing li a:active,
+ ul.z-cp-listing li .z-cp-details a:active {
+ color: linkColor;
+ background-color: transparent;
+ }
+
+ ul.z-cp-listing li span {
+ border: 0;
+ border-bottom: 1px dotted discreetColor;
+ }
+
+ ul.z-cp-listing li .z-cp-details span a {
+ border-bottom: 0px;
+ }
+
+ ul.z-cp-listing li label {
+ font-weight: bold;
+ border-bottom: borderWidth dotted discreetColor;
+ }
+
+ ul.z-cp-listing li {
+ border: 1px solid contentBackgroundColor;
+ }
+
+ ul.z-cp-listing li .z-cp-details div {
+ color: discreetColor;
+ font-size: fontSmallSize;
+ }
+
+ ul.z-cp-listing li ul.z-cp-listing {
+ margin-left: 1.5em;
+ font-size: 110%;
+ }
+
+ ul.z-cp-listing li .z-cp-details div span {
+ color: discreetColor;
+ font-size: fontSmallSize;
+ border: 0;
+ }
+
+ .z-cp-level1 {
+ padding-left: 0.8em;
+ }
+
+ .z-cp-level2 {
+ padding-left: 1.6em;
+ }
+
+ .z-cp-level3 {
+ padding-left: 2.4em;
+ }
+
+ .z-cp-level4 {
+ padding-left: 3.2em;
+ }
+
+ #z-controlpanel .z-form-add,
+ #z-controlpanel .z-form-edit {
+ border: borderWidth borderStyle globalExtraBorderColor;
+ margin-top: 0em;
+ padding: 1em;
+ background: contentBackgroundColor;
+ }
+}
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/configlet.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/configlet.py 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/configlet.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -22,7 +22,7 @@
from zope.security.proxy import removeSecurityProxy
from zope.interface.common.mapping import IEnumerableMapping
-from interfaces import IConfiglet, IDataStorage
+from interfaces import IConfiglet, IConfigletData
_marker = object()
@@ -37,17 +37,8 @@
@property
def data(self):
- storage = removeSecurityProxy(getUtility(IDataStorage))
+ return IConfigletData(self)
- if self.__id__ in storage:
- return storage[self.__id__]
-
- if self.__name__ in storage:
- storage[self.__id__] = storage[self.__name__]
- del storage[self.__name__]
-
- return storage[self.__id__]
-
def isAvailable(self):
for test in self.__tests__:
if not test(self):
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/configlettype.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/configlettype.py 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/configlettype.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -21,6 +21,7 @@
from z3ext.controlpanel.interfaces import _
from z3ext.controlpanel.configlet import Configlet
+
_marker = object()
@@ -121,6 +122,7 @@
Now we need content class
+ >>> from z3ext.controlpanel.storage import ConfigletData
>>> from z3ext.controlpanel.configlettype import ConfigletProperty
>>> class Content(object):
...
@@ -129,7 +131,7 @@
Lets create class instance and add field values storage
>>> ob = Content()
- >>> ob.data = {}
+ >>> ob.data = ConfigletData()
By default we should get field default value
@@ -147,6 +149,9 @@
>>> ob.attr1
u'value1'
+ >>> ob.data['attr1']
+ u'value1'
+
If storage contains field value we shuld get it
>>> ob.data['attr1'] = u'value2'
@@ -183,10 +188,11 @@
def __set__(self, inst, value):
field = self.__field.bind(inst)
field.validate(value)
- if field.readonly and self.__name in inst.data:
+ if field.readonly and \
+ inst.data.get(self.__name, _marker) is not _marker:
raise ValueError(self.__name, _(u'Field is readonly'))
+
inst.data[self.__name] = value
def __delete__(self, inst):
- if self.__name in inst.data:
- del inst.data[self.__name]
+ del inst.data[self.__name]
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/configure.zcml
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/configure.zcml 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/configure.zcml 2008-10-07 13:25:17 UTC (rev 91845)
@@ -1,9 +1,10 @@
<configure
xmlns="http://namespaces.zope.org/zope"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:z3ext="http://namespaces.zope.org/z3ext"
- i18n_domain="z3ext">
+ i18n_domain="z3ext.controlpanel">
- <includeDependencies package="z3ext.controlpanel" />
+ <includeDependencies package="." />
<permission
id="z3ext.Configure"
@@ -20,10 +21,23 @@
zope.interface.common.mapping.IEnumerableMapping" />
</class>
- <!-- data storage -->
- <utility factory=".storage.DataStorage" />
- <subscriber handler=".storage.dataStorageCopied" />
+ <!-- configlet data -->
+ <adapter factory=".storage.getConfigletData" />
+ <adapter factory=".storage.getConfigletDataStorage" />
+ <adapter factory=".storage.DefaultConfigletDataFactory" />
+ <class class=".storage.ConfigletData">
+ <require
+ permission="zope.ManageApplication"
+ interface="zope.app.container.interfaces.IContainer" />
+ </class>
+
+ <class class=".storage.ConfigletDataStorage">
+ <require
+ permission="zope.ManageApplication"
+ interface="zope.app.container.interfaces.IContainer" />
+ </class>
+
<!-- default categories -->
<z3ext:configlet
name="system"
@@ -48,8 +62,6 @@
provides="zope.interface.Interface"
factory=".root.getSettings" />
- <adapter factory=".root.Traversable" />
-
<!-- Configlet publisher -->
<adapter
for=".interfaces.IConfiglet *"
@@ -76,4 +88,13 @@
parent="z3ext" />
</configure>
+ <!-- generations -->
+ <utility
+ name="z3ext.controlpanel"
+ provides="zope.app.generations.interfaces.ISchemaManager"
+ component=".generations.schemaManager" />
+
+ <!-- translations -->
+ <i18n:registerTranslations directory="locales"/>
+
</configure>
Added: z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/__init__.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/__init__.py (rev 0)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/__init__.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -0,0 +1,23 @@
+##############################################################################
+#
+# Copyright (c) 2008 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.app.generations.generations import SchemaManager
+
+schemaManager = SchemaManager(
+ minimum_generation=0,
+ generation=0,
+ package_name='z3ext.controlpanel.generations')
Property changes on: z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/install.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/install.py (rev 0)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/install.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -0,0 +1,58 @@
+##############################################################################
+#
+# Copyright (c) 2008 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 event
+from zope.app.component.interfaces import ISite
+from zope.app.generations.utility import findObjectsProviding
+from zope.app.publication.zopepublication import ZopePublication
+from zope.lifecycleevent import ObjectCreatedEvent
+from z3ext.controlpanel.storage import ConfigletData, ConfigletDataStorage
+
+
+def evolve(context):
+ root = context.connection.root()[ZopePublication.root_name]
+
+ for site in findObjectsProviding(root, ISite):
+ ann = getattr(site, '__annotations__', None)
+ if ann is None:
+ continue
+
+ data = ann.get('z3ext.controlpanel.Settings')
+ if data is None:
+ continue
+
+ sm = site.getSiteManager()
+
+ storage = ConfigletDataStorage()
+ event.notify(ObjectCreatedEvent(storage))
+
+ if 'controlpanel' in sm:
+ del sm['controlpanel']
+
+ sm['controlpanel'] = storage
+
+ for name, cdata in data.items():
+ configlet = ConfigletData()
+ event.notify(ObjectCreatedEvent(storage))
+ storage[name] = configlet
+
+ for n, v in cdata.items():
+ configlet[n] = v
+
+ print configlet
+
+ del ann['z3ext.controlpanel.Settings']
Property changes on: z3ext.controlpanel/trunk/src/z3ext/controlpanel/generations/install.py
___________________________________________________________________
Name: svn:keywords
+ Id
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/interfaces.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/interfaces.py 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/interfaces.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -19,7 +19,7 @@
from zope.location.interfaces import ILocation
from zope.i18nmessageid import MessageFactory
-_ = MessageFactory('z3ext')
+_ = MessageFactory('z3ext.controlpanel')
class ICategory(interface.Interface):
@@ -42,16 +42,6 @@
""" Portal UI related settings """
-class IDataStorage(interface.Interface):
- """ data storage """
-
- def get(name):
- """ get named data """
-
- def __getitem__(name):
- """ get named data """
-
-
class IConfiglet(ILocation):
"""A group of settings."""
@@ -74,3 +64,15 @@
def isAvailable():
""" is configlet available in current site """
+
+
+class IConfigletData(interface.Interface):
+ """ configlet data storage """
+
+
+class IConfigletDataFactory(interface.Interface):
+ """ configlet data factory """
+
+
+class IConfigletDataStorage(interface.Interface):
+ """ container for IConfigletData """
Added: z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/LC_MESSAGES/z3ext.controlpanel.mo
===================================================================
(Binary files differ)
Property changes on: z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/LC_MESSAGES/z3ext.controlpanel.mo
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/LC_MESSAGES/z3ext.controlpanel.po
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/LC_MESSAGES/z3ext.controlpanel.po (rev 0)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/ru/LC_MESSAGES/z3ext.controlpanel.po 2008-10-07 13:25:17 UTC (rev 91845)
@@ -0,0 +1,62 @@
+##############################################################################
+#
+# Copyright (c) 2003-2004 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.
+#
+##############################################################################
+msgid ""
+msgstr ""
+"Project-Id-Version: z3ext.controlpanel\n"
+"POT-Creation-Date: Tue Oct 7 18:55:43 2008\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: Nikolay Kim <fafhrd91 at gmail.com>\n"
+"Language-Team: Zope 3 Developers <zope3-dev at zope.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: zope/app/locales/extract.py\n"
+
+#: src/z3ext/controlpanel/browser/category.pt:8
+msgid "There are no configlets in this category."
+msgstr "Ð ÑÑой каÑегоÑии Ð½ÐµÑ ÐºÐ¾Ð½ÑиглеÑов."
+
+#: src/z3ext/controlpanel/browser/configure.zcml:24
+msgid "View"
+msgstr "ÐÑоÑмоÑÑ"
+
+#: src/z3ext/controlpanel/configlettype.py:193
+msgid "Field is readonly"
+msgstr "Ðоле ÑолÑко Ð´Ð»Ñ ÑÑениÑ"
+
+#: src/z3ext/controlpanel/configure.zcml:41
+msgid "This area allows you to configure system."
+msgstr ""
+
+#: src/z3ext/controlpanel/configure.zcml:41
+msgid "System configuration"
+msgstr "ÐонÑигÑÑаÑÐ¸Ñ ÑиÑÑемÑ"
+
+#: src/z3ext/controlpanel/configure.zcml:49
+msgid "User interface configuration"
+msgstr "ÐонÑигÑÑаÑÐ¸Ñ Ð¿Ð¾Ð»ÑзоваÑелÑÑкого инÑеÑÑейÑа"
+
+#: src/z3ext/controlpanel/configure.zcml:49
+msgid "This area allows you to configure portal look&feel."
+msgstr ""
+
+#: src/z3ext/controlpanel/configure.zcml:8
+msgid "Configure control panel's configlets."
+msgstr ""
+
+#: src/z3ext/controlpanel/root.py:36
+#: src/z3ext/controlpanel/browser/configure.zcml:53
+#: src/z3ext/controlpanel/browser/configure.zcml:60
+msgid "System settings"
+msgstr "СиÑÑемнÑе ÑÑÑановки"
Added: z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/z3ext.controlpanel.pot
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/z3ext.controlpanel.pot (rev 0)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/locales/z3ext.controlpanel.pot 2008-10-07 13:25:17 UTC (rev 91845)
@@ -0,0 +1,63 @@
+##############################################################################
+#
+# Copyright (c) 2003-2004 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.
+#
+##############################################################################
+msgid ""
+msgstr ""
+"Project-Id-Version: Development/Unknown\n"
+"POT-Creation-Date: Tue Oct 7 18:55:43 2008\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
+"Language-Team: Zope 3 Developers <zope3-dev at zope.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: zope/app/locales/extract.py\n"
+
+#: src/z3ext/controlpanel/browser/category.pt:8
+msgid "There are no configlets in this category."
+msgstr ""
+
+#: src/z3ext/controlpanel/browser/configure.zcml:24
+msgid "View"
+msgstr ""
+
+#: src/z3ext/controlpanel/configlettype.py:193
+msgid "Field is readonly"
+msgstr ""
+
+#: src/z3ext/controlpanel/configure.zcml:41
+msgid "This area allows you to configure system."
+msgstr ""
+
+#: src/z3ext/controlpanel/configure.zcml:41
+msgid "System configuration"
+msgstr ""
+
+#: src/z3ext/controlpanel/configure.zcml:49
+msgid "User interface configuration"
+msgstr ""
+
+#: src/z3ext/controlpanel/configure.zcml:49
+msgid "This area allows you to configure portal look&feel."
+msgstr ""
+
+#: src/z3ext/controlpanel/configure.zcml:8
+msgid "Configure control panel's configlets."
+msgstr ""
+
+#: src/z3ext/controlpanel/root.py:36
+#: src/z3ext/controlpanel/browser/configure.zcml:53
+#: src/z3ext/controlpanel/browser/configure.zcml:60
+msgid "System settings"
+msgstr ""
+
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/root.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/root.py 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/root.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -54,12 +54,3 @@
if not checkPermission('z3ext.Configure', site):
raise Unauthorized('settings')
return getUtility(IConfiglet)
-
-
-class Traversable(DefaultTraversable):
- component.adapts(ISite)
-
- def traverse(self, name, furtherPath):
- if name == 'settings':
- return getUtility(IConfiglet)
- return super(Traversable, self).traverse(name, furtherPath)
Added: z3ext.controlpanel/trunk/src/z3ext/controlpanel/site.txt
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/site.txt (rev 0)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/site.txt 2008-10-07 13:25:17 UTC (rev 91845)
@@ -0,0 +1,57 @@
+==============
+Site copy/move
+==============
+
+ >>> from zope import component, interface
+ >>> from zope.app.folder.folder import Folder
+ >>> from zope.app.component.site import LocalSiteManager
+ >>> from zope.component.eventtesting import getEvents, clearEvents
+ >>> from zope.app.component.hooks import getSite, setSite
+ >>> from z3ext.controlpanel.interfaces import IConfiglet
+
+ >>> root = getSite()
+
+ >>> site = Folder()
+
+ >>> root['site'] = site
+ >>> root['subfolder'] = Folder()
+
+ >>> sm = LocalSiteManager(site)
+ >>> site.setSiteManager(sm)
+
+ >>> class IMyUtility(interface.Interface):
+ ... pass
+
+
+Register persistent utility
+
+ >>> setSite(site)
+
+ >>> configlet = component.getUtility(IConfiglet)
+ >>> configlet, configlet.data
+
+ >>> myutility = Folder()
+ >>> interface.directlyProvides(myutility, IMyUtility)
+
+ >>> configlet.data['myutility'] = Folder()
+ >>> sm.registerUtility(myutility, IMyUtility, 'my')
+
+ >>> sm.getUtility(IMyUtility, name='my') is myutility
+ True
+
+Copy site
+
+ >>> clearEvents()
+
+ >>> from zope.copypastemove.interfaces import IObjectCopier
+ >>> copier = IObjectCopier(root['site'])
+ >>> copier.copyTo(root['subfolder'])
+ u'site'
+
+ >>> newsite = root['subfolder']['site']
+ >>> newsm = newsite.getSiteManager()
+
+ >>> newsm.getUtility(IMyUtility, name='my') is myutility
+ True
+
+getEvents()
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/storage.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/storage.py 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/storage.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -11,98 +11,176 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-""" IDataStorage implementation
+""" configlet storage implementation
$Id$
"""
-from BTrees.OOBTree import OOBTree
-
from zope import interface, component, event
-from zope.proxy import removeAllProxies
-from zope.location.pickling import locationCopy
+from zope.security.proxy import removeSecurityProxy
from zope.location.interfaces import ILocation
-from zope.app.component.interfaces import ISite
-from zope.app.component.hooks import getSite, setSite
-from zope.annotation.interfaces import IAnnotations
-from zope.lifecycleevent import ObjectCopiedEvent
-from zope.lifecycleevent.interfaces import IObjectCopiedEvent
-from z3ext.controlpanel.interfaces import IDataStorage
+from zope.lifecycleevent import ObjectCreatedEvent
+from zope.app.container.btree import BTreeContainer
+from zope.app.component.hooks import getSite
+from zope.app.component.interfaces import ILocalSiteManager
-ANNOTATION_KEY = 'z3ext.controlpanel.Settings'
-_temp = {}
+from interfaces import IConfiglet, IConfigletData, IRootConfiglet
+from interfaces import IConfigletDataStorage, IConfigletDataFactory
-class DataStorage(object):
- interface.implements(IDataStorage)
+class ConfigletDataStorage(BTreeContainer):
+ interface.implements(IConfigletDataStorage)
- @property
- def _data(self):
- site = getSite()
- ann = IAnnotations(site, None)
- if ann is None:
- return _temp
- storage = ann.get(ANNOTATION_KEY)
- if storage is None:
- storage = OOBTree()
- ann[ANNOTATION_KEY] = storage
+class ConfigletData(BTreeContainer):
+ """
+ >>> data = ConfigletData()
- return storage
+ Simple values saved as object attributes
+ >>> data['attr1'] = 'value1'
+ >>> data['attr1']
+ 'value1'
+
+ >>> data.get('attr1')
+ 'value1'
+
+ >>> getattr(data, 'attr1')
+ 'value1'
+
+ >>> 'attr1' in data
+ False
+
+ >>> del data['attr1']
+
+ >>> getattr(data, 'attr1', None) is None
+ True
+
+ >>> data['attr1']
+ Traceback (most recent call last):
+ ...
+ KeyError: 'attr1'
+
+
+ Locatable objects saved as container items
+
+ >>> class Test(object):
+ ... interface.implements(ILocation)
+ ... __parent__ = __name__ = None
+
+ >>> data['attr2'] = Test()
+
+ >>> data['attr2']
+ <z3ext.controlpanel.storage.Test ...>
+
+ >>> data.get('attr2')
+ <z3ext.controlpanel.storage.Test ...>
+
+ >>> hasattr(data, 'attr2')
+ False
+
+ >>> 'attr2' in data
+ True
+
+ >>> data['attr2'].__parent__ is data
+ True
+
+ >>> del data['attr2']
+
+ >>> 'attr2' in data
+ False
+
+ >>> data['attr2']
+ Traceback (most recent call last):
+ ...
+ KeyError: 'attr2'
+
+
+ """
+
+ interface.implements(IConfigletData)
+
+ def get(self, name, default=None):
+ if name in self:
+ return super(ConfigletData, self).__getitem__(name)
+
+ elif hasattr(self, name):
+ return getattr(self, name, default)
+
+ else:
+ return default
+
def __getitem__(self, name):
- data = self._data.get(name)
+ if name in self:
+ return super(ConfigletData, self).__getitem__(name)
- if data is None:
- data = OOBTree()
- self._data[name] = data
+ elif hasattr(self, name):
+ return getattr(self, name)
- return data
+ raise KeyError(name)
- def __setitem__(self, name, data):
- self._data[name] = data
+ def __setitem__(self, name, value):
+ if ILocation.providedBy(value):
+ super(ConfigletData, self).__setitem__(name, value)
+ if hasattr(self, name):
+ delattr(self, name)
+
+ else:
+ setattr(self, name, value)
+
def __delitem__(self, name):
- if name in self._data:
- del self._data[name]
+ if name in self:
+ super(ConfigletData, self).__delitem__(name)
- def __contains__(self, name):
- return name in self._data
+ if hasattr(self, name):
+ delattr(self, name)
- at component.adapter(ISite, IObjectCopiedEvent)
-def dataStorageCopied(site, appevent):
- oldSite = getSite()
- setSite(site)
+ at component.adapter(IConfiglet)
+ at interface.implementer(IConfigletData)
+def getConfigletData(configlet):
+ site = getSite()
+ storage = IConfigletDataStorage(site.getSiteManager())
- ann = IAnnotations(removeAllProxies(appevent.original), None)
- if ann is None:
- return
+ if configlet.__id__ not in storage:
+ data = IConfigletDataFactory(configlet)()
+ event.notify(ObjectCreatedEvent(data))
- oldStorage = ann.get(ANNOTATION_KEY)
- if oldStorage is None:
- return
+ if IRootConfiglet.providedBy(configlet):
+ if '__rootconfiglet__' not in storage:
+ storage['__rootconfiglet__'] = data
+ return storage['__rootconfiglet__']
+ else:
+ storage[configlet.__id__] = data
- ann = IAnnotations(removeAllProxies(site), None)
- if ann is None:
- return
+ return storage[configlet.__id__]
- newStorage = ann.get(ANNOTATION_KEY)
- if newStorage is None:
- newStorage = OOBTree()
- ann[key] = newStorage
- for key, obj in oldStorage.items():
- copy = locationCopy(obj)
+ at component.adapter(ILocalSiteManager)
+ at interface.implementer(IConfigletDataStorage)
+def getConfigletDataStorage(siteManager):
+ sm = removeSecurityProxy(siteManager)
+
+ storage = sm.get('controlpanel', None)
+ if storage is None or not IConfigletDataStorage.providedBy(storage):
+ if storage is not None:
+ del sm['controlpanel']
- if isinstance(obj, OOBTree):
- for subkey, subobj in obj.items():
- subcopy = locationCopy(subobj)
- if ILocation.providedBy(subobj):
- subcopy.__parent__ = subcopy.__name__ = None
- event.notify(ObjectCopiedEvent(subcopy, subobj))
+ storage = ConfigletDataStorage()
+ event.notify(ObjectCreatedEvent(storage))
+ sm['controlpanel'] = storage
- copy[subkey] = subcopy
+ storage = sm['controlpanel']
- newStorage[key] = copy
+ return storage
- setSite(oldSite)
+
+class DefaultConfigletDataFactory(object):
+ component.adapts(IConfiglet)
+ interface.implements(IConfigletDataFactory)
+
+ def __init__(self, configlet):
+ self.configlet = configlet
+
+ def __call__(self, *args, **kw):
+ return ConfigletData(*args, **kw)
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/testing.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/testing.py 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/testing.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -16,7 +16,7 @@
$Id$
"""
import os
-from zope import component
+from zope import component, interface
from zope.app.testing import setup
from zope.annotation.attribute import AttributeAnnotations
from zope.app.component.hooks import getSite, setSite
@@ -25,16 +25,32 @@
from z3ext.controlpanel import storage, root, interfaces
+controlPanelData = None
+
+ at component.adapter(interface.Interface)
+ at interface.implementer(interfaces.IConfigletDataStorage)
+def getConfigletDataStorage(siteManager):
+ global controlPanelData
+ if controlPanelData is None:
+ controlPanelData = storage.ConfigletDataStorage()
+ return controlPanelData
+
+
def setUpControlPanel():
setup.setUpTraversal()
setup.setUpSiteManagerLookup()
component.provideAdapter(root.getSettings, name='settings')
component.provideAdapter(AttributeAnnotations)
- component.provideUtility(storage.DataStorage())
component.provideUtility(root.RootConfiglet(), interfaces.IConfiglet)
+ global controlPanelData
+ controlPanelData = None
+ component.provideAdapter(storage.getConfigletData)
+ component.provideAdapter(getConfigletDataStorage)
+ component.provideAdapter(storage.DefaultConfigletDataFactory)
+
z3extControlPanelLayer = ZCMLLayer(
os.path.join(os.path.split(__file__)[0], 'ftesting.zcml'),
__name__, 'z3extControlPanelLayer', allow_teardown=True)
Modified: z3ext.controlpanel/trunk/src/z3ext/controlpanel/tests.py
===================================================================
--- z3ext.controlpanel/trunk/src/z3ext/controlpanel/tests.py 2008-10-07 12:14:42 UTC (rev 91844)
+++ z3ext.controlpanel/trunk/src/z3ext/controlpanel/tests.py 2008-10-07 13:25:17 UTC (rev 91845)
@@ -18,14 +18,30 @@
__docformat__ = "reStructuredText"
import unittest, doctest
-from zope import interface, schema
+from zope import interface, component
from zope.app.testing import setup
+from zope.copypastemove import ObjectCopier
+from zope.component.event import objectEventNotify
+from zope.location.interfaces import ILocation
+from zope.app.component.site import changeSiteConfigurationAfterMove
+from zope.app.component.interfaces import ISite
+from zope.app.container.interfaces import IObjectMovedEvent
+from zope.app.container.contained import dispatchToSublocations
+
from z3ext.controlpanel.configlet import Configlet
from z3ext.controlpanel.testing import setUpControlPanel
def setUp(test):
setup.placefulSetUp(True)
+
+ component.provideAdapter(ObjectCopier)
+ component.provideHandler(objectEventNotify)
+ component.provideHandler(
+ changeSiteConfigurationAfterMove, (ISite, IObjectMovedEvent))
+ component.provideHandler(
+ dispatchToSublocations, (ILocation, IObjectMovedEvent))
+
setUpControlPanel()
setup.setUpTestAsModule(test, 'z3ext.controlpanel.README')
@@ -41,7 +57,14 @@
'README.txt',
setUp=setUp, tearDown=tearDown,
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+ doctest.DocFileSuite(
+ 'site.txt',
+ setUp=setUp, tearDown=tearDown,
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
doctest.DocTestSuite(
+ 'z3ext.controlpanel.storage',
+ optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
+ doctest.DocTestSuite(
'z3ext.controlpanel.configlettype',
optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS),
))
More information about the Checkins
mailing list