--- a/buildout.cfg Wed May 20 12:41:37 2015 +0200
+++ b/buildout.cfg Wed Jun 17 10:01:29 2015 +0200
@@ -49,6 +49,7 @@
zope.container
zope.datetime
zope.interface
+ zope.location
zope.schema
zope.site
zope.traversing
--- a/setup.py Wed May 20 12:41:37 2015 +0200
+++ b/setup.py Wed Jun 17 10:01:29 2015 +0200
@@ -80,6 +80,7 @@
'zope.container',
'zope.datetime',
'zope.interface',
+ 'zope.location',
'zope.schema',
'zope.site',
'zope.traversing'
--- a/src/pyams_utils.egg-info/SOURCES.txt Wed May 20 12:41:37 2015 +0200
+++ b/src/pyams_utils.egg-info/SOURCES.txt Wed Jun 17 10:01:29 2015 +0200
@@ -6,6 +6,7 @@
src/pyams_utils/adapter.py
src/pyams_utils/attr.py
src/pyams_utils/configure.zcml
+src/pyams_utils/container.py
src/pyams_utils/context.py
src/pyams_utils/data.py
src/pyams_utils/date.py
@@ -45,6 +46,8 @@
src/pyams_utils/interfaces/tales.py
src/pyams_utils/interfaces/text.py
src/pyams_utils/interfaces/timezone.py
+src/pyams_utils/interfaces/traversing.py
+src/pyams_utils/interfaces/tree.py
src/pyams_utils/interfaces/zeo.py
src/pyams_utils/locales/pyams_utils.pot
src/pyams_utils/locales/fr/LC_MESSAGES/pyams_utils.mo
@@ -63,6 +66,5 @@
src/pyams_utils/widget/__init__.py
src/pyams_utils/widget/decimal.py
src/pyams_utils/zmi/__init__.py
-src/pyams_utils/zmi/configure.zcml
src/pyams_utils/zmi/timezone.py
src/pyams_utils/zmi/zeo.py
\ No newline at end of file
--- a/src/pyams_utils.egg-info/requires.txt Wed May 20 12:41:37 2015 +0200
+++ b/src/pyams_utils.egg-info/requires.txt Wed Jun 17 10:01:29 2015 +0200
@@ -18,8 +18,8 @@
zope.container
zope.datetime
zope.interface
+zope.location
zope.schema
-zope.security
zope.site
zope.traversing
--- a/src/pyams_utils/configure.zcml Wed May 20 12:41:37 2015 +0200
+++ b/src/pyams_utils/configure.zcml Wed Jun 17 10:01:29 2015 +0200
@@ -7,6 +7,7 @@
<!-- Registration of external components -->
<include package="zope.component" file="meta.zcml" />
<include package="zope.browserpage" file="meta.zcml" />
+ <include package="zope.browserresource" file="meta.zcml" />
<include package="zope.i18n" file="meta.zcml" />
<include package="z3c.form" file="meta.zcml" />
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_utils/container.py Wed Jun 17 10:01:29 2015 +0200
@@ -0,0 +1,54 @@
+#
+# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
+# 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.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from zope.container.interfaces import IContainer, IContained
+from zope.location.interfaces import ISublocations
+
+# import packages
+from BTrees.OOBTree import OOBTree
+from persistent.list import PersistentList
+from pyams_utils.adapter import adapter_config, ContextAdapter
+from pyramid.threadlocal import get_current_registry
+from zope.container.ordered import OrderedContainer
+
+
+class BTreeOrderedContainer(OrderedContainer):
+ """BTree based ordered container"""
+
+ def __init__(self):
+ self._data = OOBTree()
+ self._order = PersistentList()
+
+
+@adapter_config(context=IContained, provides=ISublocations)
+class ContainerSublocationsAdapter(ContextAdapter):
+ """Container sub-locations adapter"""
+
+ def sublocations(self):
+ context = self.context
+ # Check for adapted sub-locations first...
+ registry = get_current_registry()
+ for name, adapter in registry.getAdapters((context,), ISublocations):
+ if not name: # don't reuse default adapter!!
+ continue
+ for location in adapter.sublocations():
+ yield location
+ # then yield container items
+ if IContainer.providedBy(context):
+ for key in context:
+ yield context[key]
--- a/src/pyams_utils/date.py Wed May 20 12:41:37 2015 +0200
+++ b/src/pyams_utils/date.py Wed Jun 17 10:01:29 2015 +0200
@@ -81,6 +81,8 @@
def format_date(value, format=EXT_DATE_FORMAT, request=None):
"""Format given date with the given format"""
+ if not value:
+ return '--'
if request is None:
request = check_request()
localizer = request.localizer
--- a/src/pyams_utils/interfaces/site.py Wed May 20 12:41:37 2015 +0200
+++ b/src/pyams_utils/interfaces/site.py Wed Jun 17 10:01:29 2015 +0200
@@ -47,6 +47,10 @@
"""Evolve from current generation to last one"""
+class IStaticConfigurationManager(IAttributeAnnotatable):
+ """Static configuration manager marker interface"""
+
+
class IConfigurationManager(IAttributeAnnotatable):
"""Configuration manager marker interface"""
--- a/src/pyams_utils/schema.py Wed May 20 12:41:37 2015 +0200
+++ b/src/pyams_utils/schema.py Wed Jun 17 10:01:29 2015 +0200
@@ -17,13 +17,13 @@
import string
# import interfaces
-from zope.schema.interfaces import ITextLine, IDecimal, IList, IDict, ITuple, IPassword
+from zope.schema.interfaces import IText, ITextLine, IDecimal, IList, IDict, ITuple, IPassword
# import Zope3 packages
from persistent.list import PersistentList as PersistentListType
from persistent.mapping import PersistentMapping
from zope.interface import implementer
-from zope.schema import TextLine, Decimal, List, Dict, Tuple, Password, ValidationError
+from zope.schema import Text, TextLine, Decimal, List, Dict, Tuple, Password, ValidationError
# import local packages
@@ -82,6 +82,19 @@
#
+# HTML field
+#
+
+class IHTMLField(IText):
+ """HTML field interface"""
+
+
+@implementer(IHTMLField)
+class HTMLField(Text):
+ """HTML field"""
+
+
+#
# Color field
#
--- a/src/pyams_utils/site.py Wed May 20 12:41:37 2015 +0200
+++ b/src/pyams_utils/site.py Wed Jun 17 10:01:29 2015 +0200
@@ -19,7 +19,7 @@
from pyams_utils.interfaces import PYAMS_APPLICATION_SETTINGS_KEY, PYAMS_APPLICATION_DEFAULT_NAME, \
PYAMS_APPLICATION_FACTORY_KEY
from pyams_utils.interfaces.site import ISiteRoot, INewLocalSiteCreatedEvent, ISiteUpgradeEvent, ISiteGenerations, \
- SITE_GENERATIONS_KEY, IConfigurationManager
+ SITE_GENERATIONS_KEY, IConfigurationManager, IStaticConfigurationManager
from zope.annotation.interfaces import IAnnotations
from zope.component.interfaces import IPossibleSite, ObjectEvent
from zope.traversing.interfaces import ITraversable
@@ -40,7 +40,7 @@
from zope.site.site import LocalSiteManager, SiteManagerContainer
-@implementer(ISiteRoot, IConfigurationManager)
+@implementer(ISiteRoot, IStaticConfigurationManager, IConfigurationManager)
class BaseSiteRoot(Folder, SiteManagerContainer):
"""Default site root"""
--- a/src/pyams_utils/text.py Wed May 20 12:41:37 2015 +0200
+++ b/src/pyams_utils/text.py Wed Jun 17 10:01:29 2015 +0200
@@ -59,7 +59,7 @@
return text
-@adapter_config(name='text', context=(str, IRequest), provides=IHTMLRenderer)
+@adapter_config(name='raw', context=(str, IRequest), provides=IHTMLRenderer)
class BaseHTMLRenderer(object):
"""Raw text renderer utility class"""