[Checkins] SVN: z3ext.preferences/trunk/ added bootstrap code
Nikolay Kim
fafhrd91 at gmail.com
Fri Jan 15 09:05:53 EST 2010
Log message for revision 108141:
added bootstrap code
Changed:
U z3ext.preferences/trunk/CHANGES.txt
U z3ext.preferences/trunk/setup.py
A z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.py
A z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.zcml
U z3ext.preferences/trunk/src/z3ext/preferences/configure.zcml
A z3ext.preferences/trunk/src/z3ext/preferences/exclude.zcml
U z3ext.preferences/trunk/src/z3ext/preferences/preferencetype.py
-=-
Modified: z3ext.preferences/trunk/CHANGES.txt
===================================================================
--- z3ext.preferences/trunk/CHANGES.txt 2010-01-15 12:06:13 UTC (rev 108140)
+++ z3ext.preferences/trunk/CHANGES.txt 2010-01-15 14:05:53 UTC (rev 108141)
@@ -7,7 +7,9 @@
- ZTK support
+- Added bootstrap code
+
1.5.0 (2009-10-20)
------------------
Modified: z3ext.preferences/trunk/setup.py
===================================================================
--- z3ext.preferences/trunk/setup.py 2010-01-15 12:06:13 UTC (rev 108140)
+++ z3ext.preferences/trunk/setup.py 2010-01-15 14:05:53 UTC (rev 108141)
@@ -70,8 +70,10 @@
'zope.viewlet',
'zope.contentprovider',
'zope.site',
+ 'zope.authentication',
'zope.principalannotation',
- 'zope.authentication',
+ 'zope.processlifetime',
+ 'zope.app.appsetup',
'z3c.traverser',
'z3ext.layout',
'z3ext.layoutform',
Added: z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.py
===================================================================
--- z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.py (rev 0)
+++ z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.py 2010-01-15 14:05:53 UTC (rev 108141)
@@ -0,0 +1,36 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Bootstrap code for principal annotation utility.
+
+$Id$
+"""
+import transaction
+from zope import component
+from zope.app.appsetup.bootstrap import ensureUtility, getInformationFromEvent
+from zope.processlifetime import IDatabaseOpenedWithRoot
+from zope.principalannotation.utility import PrincipalAnnotationUtility
+from zope.principalannotation.interfaces import IPrincipalAnnotationUtility
+
+
+ at component.adapter(IDatabaseOpenedWithRoot)
+def bootStrapSubscriber(event):
+ """ Create utility at that time if not yet present """
+
+ db, connection, root, root_folder = getInformationFromEvent(event)
+
+ ensureUtility(root_folder, IPrincipalAnnotationUtility,
+ 'PrincipalAnnotation', PrincipalAnnotationUtility)
+
+ transaction.commit()
+ connection.close()
Property changes on: z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.py
___________________________________________________________________
Added: svn:keywords
+ Id
Added: z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.zcml
===================================================================
--- z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.zcml (rev 0)
+++ z3ext.preferences/trunk/src/z3ext/preferences/bootstrap.zcml 2010-01-15 14:05:53 UTC (rev 108141)
@@ -0,0 +1,5 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+ <subscriber handler=".bootstrap.bootStrapSubscriber" />
+
+</configure>
Modified: z3ext.preferences/trunk/src/z3ext/preferences/configure.zcml
===================================================================
--- z3ext.preferences/trunk/src/z3ext/preferences/configure.zcml 2010-01-15 12:06:13 UTC (rev 108140)
+++ z3ext.preferences/trunk/src/z3ext/preferences/configure.zcml 2010-01-15 14:05:53 UTC (rev 108141)
@@ -68,6 +68,9 @@
<!-- browser views -->
<include package=".browser" />
+ <!-- bootstrap -->
+ <include file="bootstrap.zcml" />
+
<!-- translations -->
<i18n:registerTranslations directory="locales"/>
Added: z3ext.preferences/trunk/src/z3ext/preferences/exclude.zcml
===================================================================
--- z3ext.preferences/trunk/src/z3ext/preferences/exclude.zcml (rev 0)
+++ z3ext.preferences/trunk/src/z3ext/preferences/exclude.zcml 2010-01-15 14:05:53 UTC (rev 108141)
@@ -0,0 +1,7 @@
+<configure xmlns="http://namespaces.zope.org/zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml">
+
+ <exclude package="zope.app.principalannotation"
+ zcml:condition="installed zope.app.principalannotation" />
+
+</configure>
Modified: z3ext.preferences/trunk/src/z3ext/preferences/preferencetype.py
===================================================================
--- z3ext.preferences/trunk/src/z3ext/preferences/preferencetype.py 2010-01-15 12:06:13 UTC (rev 108140)
+++ z3ext.preferences/trunk/src/z3ext/preferences/preferencetype.py 2010-01-15 14:05:53 UTC (rev 108141)
@@ -144,7 +144,7 @@
>>> ob.attr1 = 'value1'
Traceback (most recent call last):
...
- WrongType: ('value1', <type 'unicode'>)
+ WrongType: ('value1', <type 'unicode'>, 'attr1')
>>> ob.attr1 = u'value1'
>>> ob.attr1
More information about the checkins
mailing list