[Testbot] Plone 4.3 - Python 2.7 - Build # 2613 - Still failing! - 103 failure(s)
jenkins at plone.org
jenkins at plone.org
Mon Oct 13 22:11:17 UTC 2014
-------------------------------------------------------------------------------
Plone 4.3 - Python 2.7 - Build # 2613 - Still Failing!
-------------------------------------------------------------------------------
http://jenkins.plone.org/job/plone-4.3-python-2.7/2613/
-------------------------------------------------------------------------------
CHANGES
-------------------------------------------------------------------------------
Repository: plone.supermodel
Branch: refs/heads/master
Date: 2014-10-13T18:16:15+02:00
Author: Jens W. Klein (jensens) <jk at kleinundpartner.at>
Commit: https://github.com/plone/plone.supermodel/commit/afb3bf38dd022ac8672a969696de34affcc30270
code modernization: sorted imports, use decorators, utf8 headers.
Files changed:
M CHANGES.rst
M plone/__init__.py
M plone/supermodel/__init__.py
M plone/supermodel/converters.py
M plone/supermodel/debug.py
M plone/supermodel/directives.py
M plone/supermodel/exportimport.py
M plone/supermodel/fields.py
M plone/supermodel/interfaces.py
M plone/supermodel/model.py
M plone/supermodel/parser.py
M plone/supermodel/patches.py
M plone/supermodel/serializer.py
M plone/supermodel/tests.py
M plone/supermodel/utils.py
M setup.py
diff --git a/CHANGES.rst b/CHANGES.rst
index 4892cc2..8b3c3c4 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,6 +4,9 @@ Changelog
1.2.6 (unreleased)
------------------
+- Code modernization: sorted imports, use decorators, utf8 headers.
+ [jensens]
+
- Add i18n serialization from schema value to XML model
[datakurre]
diff --git a/plone/__init__.py b/plone/__init__.py
index f48ad10..68c04af 100644
--- a/plone/__init__.py
+++ b/plone/__init__.py
@@ -1,6 +1,2 @@
-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+# -*- coding: utf-8 -*-
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/plone/supermodel/__init__.py b/plone/supermodel/__init__.py
index 4a32c8a..8cedfcb 100644
--- a/plone/supermodel/__init__.py
+++ b/plone/supermodel/__init__.py
@@ -1,12 +1,12 @@
+# -*- coding: utf-8 -*-
from StringIO import StringIO
-
-from zope.interface import moduleProvides
-
-from plone.supermodel.interfaces import FILENAME_KEY, IXMLToSchema
+from plone.supermodel import model
from plone.supermodel import parser
from plone.supermodel import serializer
from plone.supermodel import utils
-from plone.supermodel import model
+from plone.supermodel.interfaces import FILENAME_KEY
+from plone.supermodel.interfaces import IXMLToSchema
+from zope.interface import moduleProvides
# Cache models by absolute filename
_model_cache = {}
@@ -42,4 +42,10 @@ def serializeModel(model):
moduleProvides(IXMLToSchema)
-__all__ = ('xmlSchema', 'loadFile', 'loadString', 'serializeSchema', 'serializeModel')
+__all__ = (
+ 'xmlSchema',
+ 'loadFile',
+ 'loadString',
+ 'serializeSchema',
+ 'serializeModel'
+)
diff --git a/plone/supermodel/converters.py b/plone/supermodel/converters.py
index 75ebee7..a496008 100644
--- a/plone/supermodel/converters.py
+++ b/plone/supermodel/converters.py
@@ -1,23 +1,24 @@
-import time
-import datetime
-
-from zope.interface import implements
-from zope.component import adapts
-
-from zope.schema.interfaces import IField, IFromUnicode
-from zope.schema.interfaces import IDate, IDatetime, IInterfaceField, IObject
-
-from zope.dottedname.resolve import resolve
-
+# -*- coding: utf-8 -*-
from plone.supermodel.interfaces import IToUnicode
from plone.supermodel.utils import fieldTypecast
+from zope.component import adapter
+from zope.dottedname.resolve import resolve
+from zope.interface import implementer
+from zope.schema.interfaces import IDate
+from zope.schema.interfaces import IDatetime
+from zope.schema.interfaces import IField
+from zope.schema.interfaces import IFromUnicode
+from zope.schema.interfaces import IInterfaceField
+from zope.schema.interfaces import IObject
+import datetime
+import time
-# Defaults
+# Defaults
+ at implementer(IFromUnicode)
+ at adapter(IField)
class DefaultFromUnicode(object):
- implements(IFromUnicode)
- adapts(IField)
def __init__(self, context):
self.context = context
@@ -26,9 +27,9 @@ def fromUnicode(self, value):
return fieldTypecast(self.context, value)
+ at implementer(IToUnicode)
+ at adapter(IField)
class DefaultToUnicode(object):
- implements(IToUnicode)
- adapts(IField)
def __init__(self, context):
self.context = context
@@ -39,10 +40,9 @@ def toUnicode(self, value):
# Date/time fields
-
+ at implementer(IFromUnicode)
+ at adapter(IDate)
class DateFromUnicode(object):
- implements(IFromUnicode)
- adapts(IDate)
format = "%Y-%m-%d"
@@ -56,9 +56,9 @@ def fromUnicode(self, value):
return d
+ at implementer(IFromUnicode)
+ at adapter(IDatetime)
class DatetimeFromUnicode(object):
- implements(IFromUnicode)
- adapts(IDatetime)
format = "%Y-%m-%d %H:%M:%S"
@@ -74,10 +74,9 @@ def fromUnicode(self, value):
# Interface fields
-
+ at implementer(IFromUnicode)
+ at adapter(IInterfaceField)
class InterfaceFieldFromUnicode(object):
- implements(IFromUnicode)
- adapts(IInterfaceField)
def __init__(self, context):
self.context = context
@@ -88,9 +87,9 @@ def fromUnicode(self, value):
return iface
+ at implementer(IToUnicode)
+ at adapter(IInterfaceField)
class InterfaceFieldToUnicode(object):
- implements(IToUnicode)
- adapts(IInterfaceField)
def __init__(self, context):
self.context = context
@@ -104,9 +103,9 @@ def toUnicode(self, value):
# particularly useful)
+ at implementer(IFromUnicode)
+ at adapter(IObject)
class ObjectFromUnicode(object):
- implements(IFromUnicode)
- adapts(IObject)
def __init__(self, context):
self.context = context
diff --git a/plone/supermodel/debug.py b/plone/supermodel/debug.py
index 574adae..7224c6c 100644
--- a/plone/supermodel/debug.py
+++ b/plone/supermodel/debug.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import threading
diff --git a/plone/supermodel/directives.py b/plone/supermodel/directives.py
index edcc381..5d5e607 100644
--- a/plone/supermodel/directives.py
+++ b/plone/supermodel/directives.py
@@ -1,17 +1,19 @@
-import os.path
-import sys
-
-from zope.component import adapts
-from zope.interface import alsoProvides
-from zope.interface import implements
-from zope.interface.interface import TAGGED_DATA
-
+# -*- coding: utf-8 -*-
from plone.supermodel import loadFile
+from plone.supermodel.interfaces import FIELDSETS_KEY
+from plone.supermodel.interfaces import FILENAME_KEY
from plone.supermodel.interfaces import ISchema
from plone.supermodel.interfaces import ISchemaPlugin
-from plone.supermodel.interfaces import FILENAME_KEY, SCHEMA_NAME_KEY, FIELDSETS_KEY, PRIMARY_FIELDS_KEY
+from plone.supermodel.interfaces import PRIMARY_FIELDS_KEY
+from plone.supermodel.interfaces import SCHEMA_NAME_KEY
from plone.supermodel.model import Fieldset
from plone.supermodel.utils import syncSchema
+from zope.component import adapter
+from zope.interface import alsoProvides
+from zope.interface import implementer
+from zope.interface.interface import TAGGED_DATA
+import os.path
+import sys
# Directive
@@ -55,9 +57,9 @@ def store(self, tags, value):
# Plugin
+ at adapter(ISchema)
+ at implementer(ISchemaPlugin)
class CheckerPlugin(object):
- adapts(ISchema)
- implements(ISchemaPlugin)
key = None
@@ -125,9 +127,9 @@ def factory(self, filename, schema=u""):
return dict(filename=filename, schema=schema)
+ at adapter(ISchema)
+ at implementer(ISchemaPlugin)
class SupermodelSchemaPlugin(object):
- adapts(ISchema)
- implements(ISchemaPlugin)
order = -1000
diff --git a/plone/supermodel/exportimport.py b/plone/supermodel/exportimport.py
index 4723daf..b7fcb43 100644
--- a/plone/supermodel/exportimport.py
+++ b/plone/supermodel/exportimport.py
@@ -1,21 +1,22 @@
+# -*- coding: utf-8 -*-
from lxml import etree
-
-from zope.interface import Interface, implements, implementedBy
+from plone.supermodel.debug import parseinfo
+from plone.supermodel.interfaces import IDefaultFactory
+from plone.supermodel.interfaces import IFieldExportImportHandler
+from plone.supermodel.interfaces import IFieldNameExtractor
+from plone.supermodel.utils import noNS
+from plone.supermodel.utils import valueToElement
+from plone.supermodel.utils import elementToValue
from zope.component import queryUtility
-
-import zope.schema
-
+from zope.interface import Interface
+from zope.interface import implementedBy
+from zope.interface import implementer
from zope.schema.interfaces import IContextAwareDefaultFactory
from zope.schema.interfaces import IField
from zope.schema.interfaces import IVocabularyTokenized
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-
-from plone.supermodel.interfaces import IDefaultFactory
-from plone.supermodel.interfaces import IFieldNameExtractor
-from plone.supermodel.interfaces import IFieldExportImportHandler
-
-from plone.supermodel.utils import noNS, valueToElement, elementToValue
-from plone.supermodel.debug import parseinfo
+from zope.schema.vocabulary import SimpleTerm
+from zope.schema.vocabulary import SimpleVocabulary
+import zope.schema
try:
from collections import OrderedDict
@@ -27,6 +28,7 @@ class OrderedDictField(zope.schema.Dict):
_type = OrderedDict
+ at implementer(IFieldExportImportHandler)
class BaseHandler(object):
"""Base class for import/export handlers.
@@ -36,8 +38,6 @@ class BaseHandler(object):
The write_field method is called to write one field to a particular element.
"""
- implements(IFieldExportImportHandler)
-
# Elements that we will not read/write. 'r' means skip when reading;
# 'w' means skip when writing; 'rw' means skip always.
@@ -67,8 +67,11 @@ def __init__(self, klass):
for schema in implementedBy(self.klass).flattened():
self.fieldAttributes.update(zope.schema.getFields(schema))
- self.fieldAttributes['defaultFactory'] = \
- zope.schema.Object(__name__='defaultFactory', title=u"defaultFactory", schema=Interface)
+ self.fieldAttributes['defaultFactory'] = zope.schema.Object(
+ __name__='defaultFactory',
+ title=u"defaultFactory",
+ schema=Interface
+ )
def _constructField(self, attributes):
return self.klass(**attributes)
@@ -99,17 +102,26 @@ def read(self, element):
elif attribute_name in self.fieldInstanceAttributes:
attributeField_type = attribute_element.get('type')
- handler = queryUtility(IFieldExportImportHandler, name=attributeField_type)
+ handler = queryUtility(
+ IFieldExportImportHandler,
+ name=attributeField_type
+ )
if handler is None:
- raise NotImplementedError(u"Type %s used for %s not supported" %
- (attributeField_type, attribute_name))
+ raise NotImplementedError(
+ u"Type %s used for %s not supported" %
+ (attributeField_type, attribute_name)
+ )
- attributes[attribute_name] = handler.read(attribute_element)
+ attributes[attribute_name] = handler.read(
+ attribute_element
+ )
else:
- attributes[attribute_name] = \
- self.readAttribute(attribute_element, attributeField)
+ attributes[attribute_name] = self.readAttribute(
+ attribute_element,
+ attributeField
+ )
parseinfo.stack.pop()
name = element.get('name')
@@ -157,12 +169,16 @@ def read(self, element):
# restrict to those that provide IContextAwareDefaultFactory
# or IDefaultFactory
if not (
- IContextAwareDefaultFactory.providedBy(field_instance.defaultFactory) or
+ IContextAwareDefaultFactory.providedBy(
+ field_instance.defaultFactory
+ ) or
IDefaultFactory.providedBy(field_instance.defaultFactory)
- ):
- raise ImportError(u"defaultFactory must provide "
- "zope.schema.interfaces.IContextAwareDefaultFactory "
- "or plone.supermodel.IDefaultFactory")
+ ):
+ raise ImportError(
+ u"defaultFactory must provide "
+ u"zope.schema.interfaces.IContextAwareDefaultFactory "
+ u"or plone.supermodel.IDefaultFactory"
+ )
return field_instance
@@ -212,10 +228,17 @@ def writeAttribute(self, attributeField, field, ignoreDefault=True):
# The value points to another field. Recurse.
if IField.providedBy(value):
value_fieldType = IFieldNameExtractor(value)()
- handler = queryUtility(IFieldExportImportHandler, name=value_fieldType)
+ handler = queryUtility(
+ IFieldExportImportHandler,
+ name=value_fieldType
+ )
if handler is None:
return None
- return handler.write(value, name=None, type=value_fieldType, elementName=elementName)
+ return handler.write(
+ value, name=None,
+ type=value_fieldType,
+ elementName=elementName
+ )
# For 'default', 'missing_value' etc, we want to validate against
# the imported field type itself, not the field type of the attribute
@@ -223,7 +246,12 @@ def writeAttribute(self, attributeField, field, ignoreDefault=True):
elementName in self.nonValidatedfieldTypeAttributes:
attributeField = field
- return valueToElement(attributeField, value, name=elementName, force=force)
+ return valueToElement(
+ attributeField,
+ value,
+ name=elementName,
+ force=force
+ )
class DictHandler(BaseHandler):
@@ -233,8 +261,14 @@ class DictHandler(BaseHandler):
def __init__(self, klass):
super(DictHandler, self).__init__(klass)
- self.fieldAttributes['key_type'] = zope.schema.Field(__name__='key_type', title=u"Key type")
- self.fieldAttributes['value_type'] = zope.schema.Field(__name__='value_type', title=u"Value type")
+ self.fieldAttributes['key_type'] = zope.schema.Field(
+ __name__='key_type',
+ title=u"Key type"
+ )
+ self.fieldAttributes['value_type'] = zope.schema.Field(
+ __name__='value_type',
+ title=u"Value type"
+ )
class ObjectHandler(BaseHandler):
@@ -251,7 +285,9 @@ def __init__(self, klass):
super(ObjectHandler, self).__init__(klass)
# This is not correctly set in the interface
- self.fieldAttributes['schema'] = zope.schema.InterfaceField(__name__='schema')
+ self.fieldAttributes['schema'] = zope.schema.InterfaceField(
+ __name__='schema'
+ )
class ChoiceHandler(BaseHandler):
@@ -259,7 +295,13 @@ class ChoiceHandler(BaseHandler):
"""
filteredAttributes = BaseHandler.filteredAttributes.copy()
- filteredAttributes.update({'vocabulary': 'w', 'values': 'w', 'source': 'w', 'vocabularyName': 'rw'})
+ filteredAttributes.update(
+ {'vocabulary': 'w',
+ 'values': 'w',
+ 'source': 'w',
+ 'vocabularyName': 'rw'
+ }
+ )
def __init__(self, klass):
super(ChoiceHandler, self).__init__(klass)
@@ -267,17 +309,27 @@ def __init__(self, klass):
# Special options for the constructor. These are not automatically written.
self.fieldAttributes['vocabulary'] = \
- zope.schema.TextLine(__name__='vocabulary', title=u"Named vocabulary")
+ zope.schema.TextLine(
+ __name__='vocabulary',
+ title=u"Named vocabulary"
+ )
self.fieldAttributes['values'] = \
- zope.schema.List(__name__='values', title=u"Values",
- value_type=zope.schema.Text(title=u"Value"))
+ zope.schema.List(
+ __name__='values',
+ title=u"Values",
+ value_type=zope.schema.Text(title=u"Value")
+ )
# XXX: We can't be more specific about the schema, since the field
# supports both ISource and IContextSourceBinder. However, the
# initialiser will validate.
self.fieldAttributes['source'] = \
- zope.schema.Object(__name__='source', title=u"Source", schema=Interface)
+ zope.schema.Object(
+ __name__='source',
+ title=u"Source",
+ schema=Interface
+ )
def readAttribute(self, element, attributeField):
if element.tag == 'values':
@@ -300,7 +352,11 @@ def _constructField(self, attributes):
encoded = (value or '').encode('unicode_escape')
if value != encoded:
value = value or u''
- term = SimpleTerm(token=encoded, value=value, title=title)
+ term = SimpleTerm(
+ token=encoded,
+ value=value,
+ title=title
+ )
else:
term = SimpleTerm(value=value, title=title)
terms.append(term)
@@ -317,17 +373,25 @@ def write(self, field, name, type, elementName='field'):
# Named vocabulary
if field.vocabularyName is not None and field.vocabulary is None:
attributeField = self.fieldAttributes['vocabulary']
- child = valueToElement(attributeField, field.vocabularyName, name='vocabulary', force=True)
+ child = valueToElement(
+ attributeField,
+ field.vocabularyName,
+ name='vocabulary',
+ force=True
+ )
element.append(child)
# Listed vocabulary - attempt to convert to a simple list of values
- elif field.vocabularyName is None and IVocabularyTokenized.providedBy(field.vocabulary):
+ elif field.vocabularyName is None \
+ and IVocabularyTokenized.providedBy(field.vocabulary):
value = []
for term in field.vocabulary:
if (not isinstance(term.value, (str, unicode), )
or term.token != term.value.encode('unicode_escape')):
- raise NotImplementedError(u"Cannot export a vocabulary that is not "
- "based on a simple list of values")
+ raise NotImplementedError(
+ u"Cannot export a vocabulary that is not "
+ u"based on a simple list of values"
+ )
if term.title and term.title != term.value:
value.append((term.value, term.title))
else:
@@ -341,14 +405,21 @@ def write(self, field, name, type, elementName='field'):
key_type=zope.schema.TextLine(),
value_type=zope.schema.TextLine(),
)
- child = valueToElement(attributeField, value, name='values', force=True)
+ child = valueToElement(
+ attributeField,
+ value,
+ name='values',
+ force=True
+ )
element.append(child)
# Anything else is not allowed - we can't export ISource/IVocabulary or
# IContextSourceBinder objects.
else:
- raise NotImplementedError(u"Choice fields with vocabularies not based on "
- "a simple list of values or a named vocabulary "
- "cannot be exported")
+ raise NotImplementedError(
+ u"Choice fields with vocabularies not based on "
+ u"a simple list of values or a named vocabulary "
+ u"cannot be exported"
+ )
return element
diff --git a/plone/supermodel/fields.py b/plone/supermodel/fields.py
index 40dbcf1..0e993f4 100644
--- a/plone/supermodel/fields.py
+++ b/plone/supermodel/fields.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import plone.supermodel.exportimport
import zope.schema
@@ -5,10 +6,13 @@
BytesHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Bytes)
ASCIIHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.ASCII)
-BytesLineHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.BytesLine)
-ASCIILineHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.ASCIILine)
+BytesLineHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.BytesLine)
+ASCIILineHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.ASCIILine)
TextHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Text)
-TextLineHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.TextLine)
+TextLineHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.TextLine)
BoolHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Bool)
IntHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Int)
FloatHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Float)
@@ -16,15 +20,21 @@
TupleHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Tuple)
ListHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.List)
SetHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Set)
-FrozenSetHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.FrozenSet)
-PasswordHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Password)
+FrozenSetHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.FrozenSet)
+PasswordHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.Password)
DictHandler = plone.supermodel.exportimport.DictHandler(zope.schema.Dict)
-DatetimeHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Datetime)
+DatetimeHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.Datetime)
DateHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Date)
-SourceTextHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.SourceText)
+SourceTextHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.SourceText)
URIHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.URI)
IdHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Id)
-DottedNameHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.DottedName)
-InterfaceFieldHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.InterfaceField)
+DottedNameHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.DottedName)
+InterfaceFieldHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.InterfaceField)
ObjectHandler = plone.supermodel.exportimport.ObjectHandler(zope.schema.Object)
ChoiceHandler = plone.supermodel.exportimport.ChoiceHandler(zope.schema.Choice)
diff --git a/plone/supermodel/interfaces.py b/plone/supermodel/interfaces.py
index f14cafc..74fa109 100644
--- a/plone/supermodel/interfaces.py
+++ b/plone/supermodel/interfaces.py
@@ -1,13 +1,21 @@
+# -*- coding: utf-8 -*-
from zope.interface import Interface
from zope.interface.interfaces import IInterface
import zope.schema
# Keys for tagged values on interfaces
-FILENAME_KEY = 'plone.supermodel.filename' # absolute file name of model file
-SCHEMA_NAME_KEY = 'plone.supermodel.schemaname' # name of schema that was loaded from the model
-FIELDSETS_KEY = 'plone.supermodel.fieldsets' # list of fieldsets
-PRIMARY_FIELDS_KEY = 'plone.supermodel.primary' # Primary fields (requires plone.rfc822)
+# absolute file name of model file
+FILENAME_KEY = 'plone.supermodel.filename'
+
+# name of schema that was loaded from the model
+SCHEMA_NAME_KEY = 'plone.supermodel.schemaname'
+
+# list of fieldsets
+FIELDSETS_KEY = 'plone.supermodel.fieldsets'
+
+# Primary fields (requires plone.rfc822)
+PRIMARY_FIELDS_KEY = 'plone.supermodel.primary'
# The namespace for the default supermodel schema/field parser
@@ -24,14 +32,18 @@ class IModel(Interface):
"""Describes a model as generated by this library
"""
- schema = zope.schema.InterfaceField(title=u"Default schema",
- readonly=True)
+ schema = zope.schema.InterfaceField(
+ title=u"Default schema",
+ readonly=True
+ )
- schemata = zope.schema.Dict(title=u"Schemata",
- key_type=zope.schema.TextLine(title=u"Schema name",
- description=u"Default schema is under the key u''."),
- value_type=zope.schema.Object(title=u"Schema interface",
- schema=ISchema))
+ schemata = zope.schema.Dict(
+ title=u"Schemata",
+ key_type=zope.schema.TextLine(title=u"Schema name",
+ description=u"Default schema is under the key u''."),
+ value_type=zope.schema.Object(title=u"Schema interface",
+ schema=ISchema)
+ )
class IFieldset(Interface):
@@ -42,10 +54,15 @@ class IFieldset(Interface):
label = zope.schema.TextLine(title=u"Label")
- description = zope.schema.TextLine(title=u"Long description", required=False)
+ description = zope.schema.TextLine(
+ title=u"Long description",
+ required=False
+ )
- fields = zope.schema.List(title=u"Field names",
- value_type=zope.schema.TextLine(title=u"Field name"))
+ fields = zope.schema.List(
+ title=u"Field names",
+ value_type=zope.schema.TextLine(title=u"Field name")
+ )
class ISchemaPlugin(Interface):
@@ -156,8 +173,15 @@ class ISchemaMetadataHandler(Interface):
will be called.
"""
- namespace = zope.schema.URI(title=u"XML namespace used by this handler", required=False)
- prefix = zope.schema.ASCII(title=u"Preferred XML schema namespace for serialisation", required=False)
+ namespace = zope.schema.URI(
+ title=u"XML namespace used by this handler",
+ required=False
+ )
+
+ prefix = zope.schema.ASCII(
+ title=u"Preferred XML schema namespace for serialisation",
+ required=False
+ )
def read(schemaNode, schema):
"""Called once the schema in the given <schema /> node has been
@@ -177,8 +201,14 @@ class IFieldMetadataHandler(Interface):
will be called.
"""
- namespace = zope.schema.URI(title=u"XML namespace used by this handler", required=False)
- prefix = zope.schema.ASCII(title=u"Preferred XML schema namespace for serialisation", required=False)
+ namespace = zope.schema.URI(
+ title=u"XML namespace used by this handler",
+ required=False
+ )
+ prefix = zope.schema.ASCII(
+ title=u"Preferred XML schema namespace for serialisation",
+ required=False
+ )
def read(fieldNode, schema, field):
"""Called once the field in the given <field /> node has been
diff --git a/plone/supermodel/model.py b/plone/supermodel/model.py
index 52425fc..b693bb9 100644
--- a/plone/supermodel/model.py
+++ b/plone/supermodel/model.py
@@ -1,14 +1,14 @@
-import logging
-import zope.deferredimport
-from zope.component import getAdapters
-from zope.interface import Interface
-from zope.interface import implements
-from zope.interface.interface import InterfaceClass
-
-from plone.supermodel.interfaces import IModel
+# -*- coding: utf-8 -*-
from plone.supermodel.interfaces import IFieldset
+from plone.supermodel.interfaces import IModel
from plone.supermodel.interfaces import ISchema
from plone.supermodel.interfaces import ISchemaPlugin
+from zope.component import getAdapters
+from zope.interface import Interface
+from zope.interface import implementer
+from zope.interface.interface import InterfaceClass
+import logging
+import zope.deferredimport
zope.deferredimport.defineFrom('plone.supermodel.directives',
'load',
@@ -26,8 +26,8 @@
logger = logging.getLogger('plone.supermodel')
+ at implementer(IFieldset)
class Fieldset(object):
- implements(IFieldset)
def __init__(self, __name__, label=None, description=None, fields=None):
self.__name__ = __name__
@@ -43,8 +43,8 @@ def __repr__(self):
return "<Fieldset '%s' of %s>" % (self.__name__, ', '.join(self.fields))
+ at implementer(IModel)
class Model(object):
- implements(IModel)
def __init__(self, schemata=None):
if schemata is None:
@@ -58,8 +58,8 @@ def schema(self):
return self.schemata.get(u"", None)
+ at implementer(ISchema)
class SchemaClass(InterfaceClass):
- implements(ISchema)
def __init__(self, name, bases=(), attrs=None, __doc__=None,
__module__=None):
diff --git a/plone/supermodel/parser.py b/plone/supermodel/parser.py
index d9d145a..233d956 100644
--- a/plone/supermodel/parser.py
+++ b/plone/supermodel/parser.py
@@ -1,29 +1,26 @@
-import sys
-import linecache
-
+# -*- coding: utf-8 -*-
from lxml import etree
-
-from zope.interface import implements
-from zope.component import getUtility, queryUtility, getUtilitiesFor
-
-from zope.schema import getFields
-
-from zope.dottedname.resolve import resolve
-
-from plone.supermodel.interfaces import IInvariant
-from plone.supermodel.interfaces import ISchemaPolicy
+from plone.supermodel.debug import parseinfo
+from plone.supermodel.interfaces import FIELDSETS_KEY
+from plone.supermodel.interfaces import I18N_NAMESPACE
from plone.supermodel.interfaces import IFieldExportImportHandler
-
-from plone.supermodel.interfaces import ISchemaMetadataHandler
from plone.supermodel.interfaces import IFieldMetadataHandler
-
+from plone.supermodel.interfaces import IInvariant
+from plone.supermodel.interfaces import ISchemaMetadataHandler
+from plone.supermodel.interfaces import ISchemaPolicy
+from plone.supermodel.model import Fieldset
+from plone.supermodel.model import Model
+from plone.supermodel.model import Schema
+from plone.supermodel.model import SchemaClass
from plone.supermodel.utils import ns
-
-from plone.supermodel.model import Model, Fieldset, Schema, SchemaClass
-from plone.supermodel.interfaces import FIELDSETS_KEY
-from plone.supermodel.interfaces import I18N_NAMESPACE
-from plone.supermodel.debug import parseinfo
-
+from zope.component import getUtilitiesFor
+from zope.component import getUtility
+from zope.component import queryUtility
+from zope.dottedname.resolve import resolve
+from zope.interface import implementer
+from zope.schema import getFields
+import linecache
+import sys
# Exception
@@ -47,9 +44,8 @@ def __init__(self, orig_exc, fname, element):
# Helper adapters
-
+ at implementer(ISchemaPolicy)
class DefaultSchemaPolicy(object):
- implements(ISchemaPolicy)
def module(self, schemaName, tree):
return 'plone.supermodel.generated'
diff --git a/plone/supermodel/patches.py b/plone/supermodel/patches.py
index 2d4a428..785f19e 100644
--- a/plone/supermodel/patches.py
+++ b/plone/supermodel/patches.py
@@ -1,7 +1,7 @@
+# -*- coding: utf-8 -*-
import zope.interface
-import zope.schema.interfaces
-
import zope.schema
+import zope.schema.interfaces
class IDottedName(zope.interface.Interface):
diff --git a/plone/supermodel/serializer.py b/plone/supermodel/serializer.py
index 55ae942..cb91a3e 100644
--- a/plone/supermodel/serializer.py
+++ b/plone/supermodel/serializer.py
@@ -1,30 +1,28 @@
-from zope.interface import implements
-from zope.component import adapts, getUtilitiesFor
-
-from zope.schema.interfaces import IField
-
-from zope.component import queryUtility
-
+# -*- coding: utf-8 -*-
+from lxml import etree
+from plone.supermodel.interfaces import FIELDSETS_KEY
+from plone.supermodel.interfaces import I18N_NAMESPACE
from plone.supermodel.interfaces import IFieldExportImportHandler
-from plone.supermodel.interfaces import ISchemaMetadataHandler
from plone.supermodel.interfaces import IFieldMetadataHandler
-
-from plone.supermodel.interfaces import I18N_NAMESPACE
-from plone.supermodel.interfaces import XML_NAMESPACE
-from plone.supermodel.interfaces import FIELDSETS_KEY
from plone.supermodel.interfaces import IFieldNameExtractor
-
+from plone.supermodel.interfaces import ISchemaMetadataHandler
+from plone.supermodel.interfaces import XML_NAMESPACE
from plone.supermodel.model import Schema
-
-from plone.supermodel.utils import ns, sortedFields, prettyXML
-from lxml import etree
+from plone.supermodel.utils import ns
+from plone.supermodel.utils import prettyXML
+from plone.supermodel.utils import sortedFields
+from zope.component import adapter
+from zope.component import getUtilitiesFor
+from zope.component import queryUtility
+from zope.interface import implementer
+from zope.schema.interfaces import IField
+ at implementer(IFieldNameExtractor)
+ at adapter(IField)
class DefaultFieldNameExtractor(object):
"""Extract a name
"""
- implements(IFieldNameExtractor)
- adapts(IField)
def __init__(self, context):
self.context = context
diff --git a/plone/supermodel/tests.py b/plone/supermodel/tests.py
index 4e9a7ed..e47c864 100644
--- a/plone/supermodel/tests.py
+++ b/plone/supermodel/tests.py
@@ -1,23 +1,24 @@
+# -*- coding: utf-8 -*-
from cStringIO import StringIO
-import doctest
-import unittest
-
from lxml import etree
-
-from zope.interface import Interface, implements, alsoProvides, provider
-from zope.interface import Invalid
-import zope.component.testing
-
-from zope.schema import getFieldNamesInOrder
-from zope.schema.interfaces import IContextAwareDefaultFactory
-from zope.schema.interfaces import IContextSourceBinder
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-from zope import schema
-
from plone.supermodel import utils
from plone.supermodel.exportimport import ChoiceHandler
from plone.supermodel.interfaces import IDefaultFactory
from plone.supermodel.interfaces import IInvariant
+from zope import schema
+from zope.interface import Interface
+from zope.interface import Invalid
+from zope.interface import alsoProvides
+from zope.interface import implementer
+from zope.interface import provider
+from zope.schema import getFieldNamesInOrder
+from zope.schema.interfaces import IContextAwareDefaultFactory
+from zope.schema.interfaces import IContextSourceBinder
+from zope.schema.vocabulary import SimpleTerm
+from zope.schema.vocabulary import SimpleVocabulary
+import doctest
+import unittest
+import zope.component.testing
def configure():
@@ -49,8 +50,8 @@ class IDummy(Interface):
title = schema.TextLine(title=u"Title")
+ at implementer(IDummy)
class Dummy(object):
- implements(IDummy)
def __init__(self):
self.title = u''
@@ -59,8 +60,8 @@ def __init__(self):
dummy1 = Dummy()
+ at implementer(IContextSourceBinder)
class Binder(object):
- implements(IContextSourceBinder)
def __init__(self):
pass
diff --git a/plone/supermodel/utils.py b/plone/supermodel/utils.py
index 34f7db2..5226662 100644
--- a/plone/supermodel/utils.py
+++ b/plone/supermodel/utils.py
@@ -1,15 +1,19 @@
-import os.path
-import sys
-import re
-
+# -*- coding: utf-8 -*-
from lxml import etree
-
-from zope.interface import directlyProvidedBy, directlyProvides
-from zope.schema.interfaces import IField, IFromUnicode, IDict, ICollection
-from zope.i18nmessageid import Message
-
-from plone.supermodel.interfaces import XML_NAMESPACE, I18N_NAMESPACE, IToUnicode
from plone.supermodel.debug import parseinfo
+from plone.supermodel.interfaces import I18N_NAMESPACE
+from plone.supermodel.interfaces import IToUnicode
+from plone.supermodel.interfaces import XML_NAMESPACE
+from zope.i18nmessageid import Message
+from zope.interface import directlyProvidedBy
+from zope.interface import directlyProvides
+from zope.schema.interfaces import ICollection
+from zope.schema.interfaces import IDict
+from zope.schema.interfaces import IField
+from zope.schema.interfaces import IFromUnicode
+import os.path
+import re
+import sys
try:
from collections import OrderedDict
diff --git a/setup.py b/setup.py
index 15a6c52..48f27cb 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,8 @@
+# -*- coding: utf-8 -*-
+from setuptools import find_packages
+from setuptools import setup
import os
import sys
-from setuptools import setup, find_packages
# if <= Python 2.6 or less, specify minimum zope.schema compatible:
@@ -21,45 +23,46 @@ def read(*rnames):
+ '\n'
)
-setup(name='plone.supermodel',
- version=version,
- description="Serialize Zope schema definitions to and from XML",
- long_description=long_description,
- # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
- classifiers=[
+setup(
+ name='plone.supermodel',
+ version=version,
+ description="Serialize Zope schema definitions to and from XML",
+ long_description=long_description,
+ # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=[
"Framework :: Plone",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: BSD License",
- ],
- keywords='Plone XML schema',
- author='Martin Aspeli',
- author_email='optilude at gmail.com',
- url='http://code.google.com/p/dexterity',
- license='BSD',
- packages=find_packages(exclude=['ez_setup']),
- namespace_packages=['plone'],
- include_package_data=True,
- zip_safe=False,
- install_requires=[
- 'setuptools',
- 'lxml',
- 'zope.component',
- 'zope.i18nmessageid',
- 'zope.interface',
- ZOPESCHEMA,
- 'zope.deferredimport',
- 'zope.dottedname',
- 'z3c.zcmlhook',
- ],
- extras_require={
+ ],
+ keywords='Plone XML schema',
+ author='Martin Aspeli',
+ author_email='optilude at gmail.com',
+ url='http://code.google.com/p/dexterity',
+ license='BSD',
+ packages=find_packages(exclude=['ez_setup']),
+ namespace_packages=['plone'],
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'setuptools',
+ 'lxml',
+ 'zope.component',
+ 'zope.i18nmessageid',
+ 'zope.interface',
+ ZOPESCHEMA,
+ 'zope.deferredimport',
+ 'zope.dottedname',
+ 'z3c.zcmlhook',
+ ],
+ extras_require={
'lxml': [], # BBB
'plone.rfc822': ['plone.rfc822'],
'test': [
'plone.rfc822',
],
- },
- entry_points="""
- # -*- Entry points: -*-
- """,
- )
+ },
+ entry_points="""
+ # -*- Entry points: -*-
+ """,
+ )
Repository: plone.supermodel
Branch: refs/heads/master
Date: 2014-10-13T23:44:49+02:00
Author: Gil Forcada (gforcada) <gforcada at gnome.org>
Commit: https://github.com/plone/plone.supermodel/commit/34182d050219a1b8d014a715e306d78c9af2a22c
Merge pull request #10 from plone/jensens-cleanup
code modernization: sorted imports, use decorators, utf8 headers.
Files changed:
M CHANGES.rst
M plone/__init__.py
M plone/supermodel/__init__.py
M plone/supermodel/converters.py
M plone/supermodel/debug.py
M plone/supermodel/directives.py
M plone/supermodel/exportimport.py
M plone/supermodel/fields.py
M plone/supermodel/interfaces.py
M plone/supermodel/model.py
M plone/supermodel/parser.py
M plone/supermodel/patches.py
M plone/supermodel/serializer.py
M plone/supermodel/tests.py
M plone/supermodel/utils.py
M setup.py
diff --git a/CHANGES.rst b/CHANGES.rst
index 4892cc2..8b3c3c4 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -4,6 +4,9 @@ Changelog
1.2.6 (unreleased)
------------------
+- Code modernization: sorted imports, use decorators, utf8 headers.
+ [jensens]
+
- Add i18n serialization from schema value to XML model
[datakurre]
diff --git a/plone/__init__.py b/plone/__init__.py
index f48ad10..68c04af 100644
--- a/plone/__init__.py
+++ b/plone/__init__.py
@@ -1,6 +1,2 @@
-# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+# -*- coding: utf-8 -*-
+__import__('pkg_resources').declare_namespace(__name__)
diff --git a/plone/supermodel/__init__.py b/plone/supermodel/__init__.py
index 4a32c8a..8cedfcb 100644
--- a/plone/supermodel/__init__.py
+++ b/plone/supermodel/__init__.py
@@ -1,12 +1,12 @@
+# -*- coding: utf-8 -*-
from StringIO import StringIO
-
-from zope.interface import moduleProvides
-
-from plone.supermodel.interfaces import FILENAME_KEY, IXMLToSchema
+from plone.supermodel import model
from plone.supermodel import parser
from plone.supermodel import serializer
from plone.supermodel import utils
-from plone.supermodel import model
+from plone.supermodel.interfaces import FILENAME_KEY
+from plone.supermodel.interfaces import IXMLToSchema
+from zope.interface import moduleProvides
# Cache models by absolute filename
_model_cache = {}
@@ -42,4 +42,10 @@ def serializeModel(model):
moduleProvides(IXMLToSchema)
-__all__ = ('xmlSchema', 'loadFile', 'loadString', 'serializeSchema', 'serializeModel')
+__all__ = (
+ 'xmlSchema',
+ 'loadFile',
+ 'loadString',
+ 'serializeSchema',
+ 'serializeModel'
+)
diff --git a/plone/supermodel/converters.py b/plone/supermodel/converters.py
index 75ebee7..a496008 100644
--- a/plone/supermodel/converters.py
+++ b/plone/supermodel/converters.py
@@ -1,23 +1,24 @@
-import time
-import datetime
-
-from zope.interface import implements
-from zope.component import adapts
-
-from zope.schema.interfaces import IField, IFromUnicode
-from zope.schema.interfaces import IDate, IDatetime, IInterfaceField, IObject
-
-from zope.dottedname.resolve import resolve
-
+# -*- coding: utf-8 -*-
from plone.supermodel.interfaces import IToUnicode
from plone.supermodel.utils import fieldTypecast
+from zope.component import adapter
+from zope.dottedname.resolve import resolve
+from zope.interface import implementer
+from zope.schema.interfaces import IDate
+from zope.schema.interfaces import IDatetime
+from zope.schema.interfaces import IField
+from zope.schema.interfaces import IFromUnicode
+from zope.schema.interfaces import IInterfaceField
+from zope.schema.interfaces import IObject
+import datetime
+import time
-# Defaults
+# Defaults
+ at implementer(IFromUnicode)
+ at adapter(IField)
class DefaultFromUnicode(object):
- implements(IFromUnicode)
- adapts(IField)
def __init__(self, context):
self.context = context
@@ -26,9 +27,9 @@ def fromUnicode(self, value):
return fieldTypecast(self.context, value)
+ at implementer(IToUnicode)
+ at adapter(IField)
class DefaultToUnicode(object):
- implements(IToUnicode)
- adapts(IField)
def __init__(self, context):
self.context = context
@@ -39,10 +40,9 @@ def toUnicode(self, value):
# Date/time fields
-
+ at implementer(IFromUnicode)
+ at adapter(IDate)
class DateFromUnicode(object):
- implements(IFromUnicode)
- adapts(IDate)
format = "%Y-%m-%d"
@@ -56,9 +56,9 @@ def fromUnicode(self, value):
return d
+ at implementer(IFromUnicode)
+ at adapter(IDatetime)
class DatetimeFromUnicode(object):
- implements(IFromUnicode)
- adapts(IDatetime)
format = "%Y-%m-%d %H:%M:%S"
@@ -74,10 +74,9 @@ def fromUnicode(self, value):
# Interface fields
-
+ at implementer(IFromUnicode)
+ at adapter(IInterfaceField)
class InterfaceFieldFromUnicode(object):
- implements(IFromUnicode)
- adapts(IInterfaceField)
def __init__(self, context):
self.context = context
@@ -88,9 +87,9 @@ def fromUnicode(self, value):
return iface
+ at implementer(IToUnicode)
+ at adapter(IInterfaceField)
class InterfaceFieldToUnicode(object):
- implements(IToUnicode)
- adapts(IInterfaceField)
def __init__(self, context):
self.context = context
@@ -104,9 +103,9 @@ def toUnicode(self, value):
# particularly useful)
+ at implementer(IFromUnicode)
+ at adapter(IObject)
class ObjectFromUnicode(object):
- implements(IFromUnicode)
- adapts(IObject)
def __init__(self, context):
self.context = context
diff --git a/plone/supermodel/debug.py b/plone/supermodel/debug.py
index 574adae..7224c6c 100644
--- a/plone/supermodel/debug.py
+++ b/plone/supermodel/debug.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import threading
diff --git a/plone/supermodel/directives.py b/plone/supermodel/directives.py
index edcc381..5d5e607 100644
--- a/plone/supermodel/directives.py
+++ b/plone/supermodel/directives.py
@@ -1,17 +1,19 @@
-import os.path
-import sys
-
-from zope.component import adapts
-from zope.interface import alsoProvides
-from zope.interface import implements
-from zope.interface.interface import TAGGED_DATA
-
+# -*- coding: utf-8 -*-
from plone.supermodel import loadFile
+from plone.supermodel.interfaces import FIELDSETS_KEY
+from plone.supermodel.interfaces import FILENAME_KEY
from plone.supermodel.interfaces import ISchema
from plone.supermodel.interfaces import ISchemaPlugin
-from plone.supermodel.interfaces import FILENAME_KEY, SCHEMA_NAME_KEY, FIELDSETS_KEY, PRIMARY_FIELDS_KEY
+from plone.supermodel.interfaces import PRIMARY_FIELDS_KEY
+from plone.supermodel.interfaces import SCHEMA_NAME_KEY
from plone.supermodel.model import Fieldset
from plone.supermodel.utils import syncSchema
+from zope.component import adapter
+from zope.interface import alsoProvides
+from zope.interface import implementer
+from zope.interface.interface import TAGGED_DATA
+import os.path
+import sys
# Directive
@@ -55,9 +57,9 @@ def store(self, tags, value):
# Plugin
+ at adapter(ISchema)
+ at implementer(ISchemaPlugin)
class CheckerPlugin(object):
- adapts(ISchema)
- implements(ISchemaPlugin)
key = None
@@ -125,9 +127,9 @@ def factory(self, filename, schema=u""):
return dict(filename=filename, schema=schema)
+ at adapter(ISchema)
+ at implementer(ISchemaPlugin)
class SupermodelSchemaPlugin(object):
- adapts(ISchema)
- implements(ISchemaPlugin)
order = -1000
diff --git a/plone/supermodel/exportimport.py b/plone/supermodel/exportimport.py
index 4723daf..b7fcb43 100644
--- a/plone/supermodel/exportimport.py
+++ b/plone/supermodel/exportimport.py
@@ -1,21 +1,22 @@
+# -*- coding: utf-8 -*-
from lxml import etree
-
-from zope.interface import Interface, implements, implementedBy
+from plone.supermodel.debug import parseinfo
+from plone.supermodel.interfaces import IDefaultFactory
+from plone.supermodel.interfaces import IFieldExportImportHandler
+from plone.supermodel.interfaces import IFieldNameExtractor
+from plone.supermodel.utils import noNS
+from plone.supermodel.utils import valueToElement
+from plone.supermodel.utils import elementToValue
from zope.component import queryUtility
-
-import zope.schema
-
+from zope.interface import Interface
+from zope.interface import implementedBy
+from zope.interface import implementer
from zope.schema.interfaces import IContextAwareDefaultFactory
from zope.schema.interfaces import IField
from zope.schema.interfaces import IVocabularyTokenized
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-
-from plone.supermodel.interfaces import IDefaultFactory
-from plone.supermodel.interfaces import IFieldNameExtractor
-from plone.supermodel.interfaces import IFieldExportImportHandler
-
-from plone.supermodel.utils import noNS, valueToElement, elementToValue
-from plone.supermodel.debug import parseinfo
+from zope.schema.vocabulary import SimpleTerm
+from zope.schema.vocabulary import SimpleVocabulary
+import zope.schema
try:
from collections import OrderedDict
@@ -27,6 +28,7 @@ class OrderedDictField(zope.schema.Dict):
_type = OrderedDict
+ at implementer(IFieldExportImportHandler)
class BaseHandler(object):
"""Base class for import/export handlers.
@@ -36,8 +38,6 @@ class BaseHandler(object):
The write_field method is called to write one field to a particular element.
"""
- implements(IFieldExportImportHandler)
-
# Elements that we will not read/write. 'r' means skip when reading;
# 'w' means skip when writing; 'rw' means skip always.
@@ -67,8 +67,11 @@ def __init__(self, klass):
for schema in implementedBy(self.klass).flattened():
self.fieldAttributes.update(zope.schema.getFields(schema))
- self.fieldAttributes['defaultFactory'] = \
- zope.schema.Object(__name__='defaultFactory', title=u"defaultFactory", schema=Interface)
+ self.fieldAttributes['defaultFactory'] = zope.schema.Object(
+ __name__='defaultFactory',
+ title=u"defaultFactory",
+ schema=Interface
+ )
def _constructField(self, attributes):
return self.klass(**attributes)
@@ -99,17 +102,26 @@ def read(self, element):
elif attribute_name in self.fieldInstanceAttributes:
attributeField_type = attribute_element.get('type')
- handler = queryUtility(IFieldExportImportHandler, name=attributeField_type)
+ handler = queryUtility(
+ IFieldExportImportHandler,
+ name=attributeField_type
+ )
if handler is None:
- raise NotImplementedError(u"Type %s used for %s not supported" %
- (attributeField_type, attribute_name))
+ raise NotImplementedError(
+ u"Type %s used for %s not supported" %
+ (attributeField_type, attribute_name)
+ )
- attributes[attribute_name] = handler.read(attribute_element)
+ attributes[attribute_name] = handler.read(
+ attribute_element
+ )
else:
- attributes[attribute_name] = \
- self.readAttribute(attribute_element, attributeField)
+ attributes[attribute_name] = self.readAttribute(
+ attribute_element,
+ attributeField
+ )
parseinfo.stack.pop()
name = element.get('name')
@@ -157,12 +169,16 @@ def read(self, element):
# restrict to those that provide IContextAwareDefaultFactory
# or IDefaultFactory
if not (
- IContextAwareDefaultFactory.providedBy(field_instance.defaultFactory) or
+ IContextAwareDefaultFactory.providedBy(
+ field_instance.defaultFactory
+ ) or
IDefaultFactory.providedBy(field_instance.defaultFactory)
- ):
- raise ImportError(u"defaultFactory must provide "
- "zope.schema.interfaces.IContextAwareDefaultFactory "
- "or plone.supermodel.IDefaultFactory")
+ ):
+ raise ImportError(
+ u"defaultFactory must provide "
+ u"zope.schema.interfaces.IContextAwareDefaultFactory "
+ u"or plone.supermodel.IDefaultFactory"
+ )
return field_instance
@@ -212,10 +228,17 @@ def writeAttribute(self, attributeField, field, ignoreDefault=True):
# The value points to another field. Recurse.
if IField.providedBy(value):
value_fieldType = IFieldNameExtractor(value)()
- handler = queryUtility(IFieldExportImportHandler, name=value_fieldType)
+ handler = queryUtility(
+ IFieldExportImportHandler,
+ name=value_fieldType
+ )
if handler is None:
return None
- return handler.write(value, name=None, type=value_fieldType, elementName=elementName)
+ return handler.write(
+ value, name=None,
+ type=value_fieldType,
+ elementName=elementName
+ )
# For 'default', 'missing_value' etc, we want to validate against
# the imported field type itself, not the field type of the attribute
@@ -223,7 +246,12 @@ def writeAttribute(self, attributeField, field, ignoreDefault=True):
elementName in self.nonValidatedfieldTypeAttributes:
attributeField = field
- return valueToElement(attributeField, value, name=elementName, force=force)
+ return valueToElement(
+ attributeField,
+ value,
+ name=elementName,
+ force=force
+ )
class DictHandler(BaseHandler):
@@ -233,8 +261,14 @@ class DictHandler(BaseHandler):
def __init__(self, klass):
super(DictHandler, self).__init__(klass)
- self.fieldAttributes['key_type'] = zope.schema.Field(__name__='key_type', title=u"Key type")
- self.fieldAttributes['value_type'] = zope.schema.Field(__name__='value_type', title=u"Value type")
+ self.fieldAttributes['key_type'] = zope.schema.Field(
+ __name__='key_type',
+ title=u"Key type"
+ )
+ self.fieldAttributes['value_type'] = zope.schema.Field(
+ __name__='value_type',
+ title=u"Value type"
+ )
class ObjectHandler(BaseHandler):
@@ -251,7 +285,9 @@ def __init__(self, klass):
super(ObjectHandler, self).__init__(klass)
# This is not correctly set in the interface
- self.fieldAttributes['schema'] = zope.schema.InterfaceField(__name__='schema')
+ self.fieldAttributes['schema'] = zope.schema.InterfaceField(
+ __name__='schema'
+ )
class ChoiceHandler(BaseHandler):
@@ -259,7 +295,13 @@ class ChoiceHandler(BaseHandler):
"""
filteredAttributes = BaseHandler.filteredAttributes.copy()
- filteredAttributes.update({'vocabulary': 'w', 'values': 'w', 'source': 'w', 'vocabularyName': 'rw'})
+ filteredAttributes.update(
+ {'vocabulary': 'w',
+ 'values': 'w',
+ 'source': 'w',
+ 'vocabularyName': 'rw'
+ }
+ )
def __init__(self, klass):
super(ChoiceHandler, self).__init__(klass)
@@ -267,17 +309,27 @@ def __init__(self, klass):
# Special options for the constructor. These are not automatically written.
self.fieldAttributes['vocabulary'] = \
- zope.schema.TextLine(__name__='vocabulary', title=u"Named vocabulary")
+ zope.schema.TextLine(
+ __name__='vocabulary',
+ title=u"Named vocabulary"
+ )
self.fieldAttributes['values'] = \
- zope.schema.List(__name__='values', title=u"Values",
- value_type=zope.schema.Text(title=u"Value"))
+ zope.schema.List(
+ __name__='values',
+ title=u"Values",
+ value_type=zope.schema.Text(title=u"Value")
+ )
# XXX: We can't be more specific about the schema, since the field
# supports both ISource and IContextSourceBinder. However, the
# initialiser will validate.
self.fieldAttributes['source'] = \
- zope.schema.Object(__name__='source', title=u"Source", schema=Interface)
+ zope.schema.Object(
+ __name__='source',
+ title=u"Source",
+ schema=Interface
+ )
def readAttribute(self, element, attributeField):
if element.tag == 'values':
@@ -300,7 +352,11 @@ def _constructField(self, attributes):
encoded = (value or '').encode('unicode_escape')
if value != encoded:
value = value or u''
- term = SimpleTerm(token=encoded, value=value, title=title)
+ term = SimpleTerm(
+ token=encoded,
+ value=value,
+ title=title
+ )
else:
term = SimpleTerm(value=value, title=title)
terms.append(term)
@@ -317,17 +373,25 @@ def write(self, field, name, type, elementName='field'):
# Named vocabulary
if field.vocabularyName is not None and field.vocabulary is None:
attributeField = self.fieldAttributes['vocabulary']
- child = valueToElement(attributeField, field.vocabularyName, name='vocabulary', force=True)
+ child = valueToElement(
+ attributeField,
+ field.vocabularyName,
+ name='vocabulary',
+ force=True
+ )
element.append(child)
# Listed vocabulary - attempt to convert to a simple list of values
- elif field.vocabularyName is None and IVocabularyTokenized.providedBy(field.vocabulary):
+ elif field.vocabularyName is None \
+ and IVocabularyTokenized.providedBy(field.vocabulary):
value = []
for term in field.vocabulary:
if (not isinstance(term.value, (str, unicode), )
or term.token != term.value.encode('unicode_escape')):
- raise NotImplementedError(u"Cannot export a vocabulary that is not "
- "based on a simple list of values")
+ raise NotImplementedError(
+ u"Cannot export a vocabulary that is not "
+ u"based on a simple list of values"
+ )
if term.title and term.title != term.value:
value.append((term.value, term.title))
else:
@@ -341,14 +405,21 @@ def write(self, field, name, type, elementName='field'):
key_type=zope.schema.TextLine(),
value_type=zope.schema.TextLine(),
)
- child = valueToElement(attributeField, value, name='values', force=True)
+ child = valueToElement(
+ attributeField,
+ value,
+ name='values',
+ force=True
+ )
element.append(child)
# Anything else is not allowed - we can't export ISource/IVocabulary or
# IContextSourceBinder objects.
else:
- raise NotImplementedError(u"Choice fields with vocabularies not based on "
- "a simple list of values or a named vocabulary "
- "cannot be exported")
+ raise NotImplementedError(
+ u"Choice fields with vocabularies not based on "
+ u"a simple list of values or a named vocabulary "
+ u"cannot be exported"
+ )
return element
diff --git a/plone/supermodel/fields.py b/plone/supermodel/fields.py
index 40dbcf1..0e993f4 100644
--- a/plone/supermodel/fields.py
+++ b/plone/supermodel/fields.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
import plone.supermodel.exportimport
import zope.schema
@@ -5,10 +6,13 @@
BytesHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Bytes)
ASCIIHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.ASCII)
-BytesLineHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.BytesLine)
-ASCIILineHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.ASCIILine)
+BytesLineHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.BytesLine)
+ASCIILineHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.ASCIILine)
TextHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Text)
-TextLineHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.TextLine)
+TextLineHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.TextLine)
BoolHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Bool)
IntHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Int)
FloatHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Float)
@@ -16,15 +20,21 @@
TupleHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Tuple)
ListHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.List)
SetHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Set)
-FrozenSetHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.FrozenSet)
-PasswordHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Password)
+FrozenSetHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.FrozenSet)
+PasswordHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.Password)
DictHandler = plone.supermodel.exportimport.DictHandler(zope.schema.Dict)
-DatetimeHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Datetime)
+DatetimeHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.Datetime)
DateHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Date)
-SourceTextHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.SourceText)
+SourceTextHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.SourceText)
URIHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.URI)
IdHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.Id)
-DottedNameHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.DottedName)
-InterfaceFieldHandler = plone.supermodel.exportimport.BaseHandler(zope.schema.InterfaceField)
+DottedNameHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.DottedName)
+InterfaceFieldHandler = plone.supermodel.exportimport.BaseHandler(
+ zope.schema.InterfaceField)
ObjectHandler = plone.supermodel.exportimport.ObjectHandler(zope.schema.Object)
ChoiceHandler = plone.supermodel.exportimport.ChoiceHandler(zope.schema.Choice)
diff --git a/plone/supermodel/interfaces.py b/plone/supermodel/interfaces.py
index f14cafc..74fa109 100644
--- a/plone/supermodel/interfaces.py
+++ b/plone/supermodel/interfaces.py
@@ -1,13 +1,21 @@
+# -*- coding: utf-8 -*-
from zope.interface import Interface
from zope.interface.interfaces import IInterface
import zope.schema
# Keys for tagged values on interfaces
-FILENAME_KEY = 'plone.supermodel.filename' # absolute file name of model file
-SCHEMA_NAME_KEY = 'plone.supermodel.schemaname' # name of schema that was loaded from the model
-FIELDSETS_KEY = 'plone.supermodel.fieldsets' # list of fieldsets
-PRIMARY_FIELDS_KEY = 'plone.supermodel.primary' # Primary fields (requires plone.rfc822)
+# absolute file name of model file
+FILENAME_KEY = 'plone.supermodel.filename'
+
+# name of schema that was loaded from the model
+SCHEMA_NAME_KEY = 'plone.supermodel.schemaname'
+
+# list of fieldsets
+FIELDSETS_KEY = 'plone.supermodel.fieldsets'
+
+# Primary fields (requires plone.rfc822)
+PRIMARY_FIELDS_KEY = 'plone.supermodel.primary'
# The namespace for the default supermodel schema/field parser
@@ -24,14 +32,18 @@ class IModel(Interface):
"""Describes a model as generated by this library
"""
- schema = zope.schema.InterfaceField(title=u"Default schema",
- readonly=True)
+ schema = zope.schema.InterfaceField(
+ title=u"Default schema",
+ readonly=True
+ )
- schemata = zope.schema.Dict(title=u"Schemata",
- key_type=zope.schema.TextLine(title=u"Schema name",
- description=u"Default schema is under the key u''."),
- value_type=zope.schema.Object(title=u"Schema interface",
- schema=ISchema))
+ schemata = zope.schema.Dict(
+ title=u"Schemata",
+ key_type=zope.schema.TextLine(title=u"Schema name",
+ description=u"Default schema is under the key u''."),
+ value_type=zope.schema.Object(title=u"Schema interface",
+ schema=ISchema)
+ )
class IFieldset(Interface):
@@ -42,10 +54,15 @@ class IFieldset(Interface):
label = zope.schema.TextLine(title=u"Label")
- description = zope.schema.TextLine(title=u"Long description", required=False)
+ description = zope.schema.TextLine(
+ title=u"Long description",
+ required=False
+ )
- fields = zope.schema.List(title=u"Field names",
- value_type=zope.schema.TextLine(title=u"Field name"))
+ fields = zope.schema.List(
+ title=u"Field names",
+ value_type=zope.schema.TextLine(title=u"Field name")
+ )
class ISchemaPlugin(Interface):
@@ -156,8 +173,15 @@ class ISchemaMetadataHandler(Interface):
will be called.
"""
- namespace = zope.schema.URI(title=u"XML namespace used by this handler", required=False)
- prefix = zope.schema.ASCII(title=u"Preferred XML schema namespace for serialisation", required=False)
+ namespace = zope.schema.URI(
+ title=u"XML namespace used by this handler",
+ required=False
+ )
+
+ prefix = zope.schema.ASCII(
+ title=u"Preferred XML schema namespace for serialisation",
+ required=False
+ )
def read(schemaNode, schema):
"""Called once the schema in the given <schema /> node has been
@@ -177,8 +201,14 @@ class IFieldMetadataHandler(Interface):
will be called.
"""
- namespace = zope.schema.URI(title=u"XML namespace used by this handler", required=False)
- prefix = zope.schema.ASCII(title=u"Preferred XML schema namespace for serialisation", required=False)
+ namespace = zope.schema.URI(
+ title=u"XML namespace used by this handler",
+ required=False
+ )
+ prefix = zope.schema.ASCII(
+ title=u"Preferred XML schema namespace for serialisation",
+ required=False
+ )
def read(fieldNode, schema, field):
"""Called once the field in the given <field /> node has been
diff --git a/plone/supermodel/model.py b/plone/supermodel/model.py
index 52425fc..b693bb9 100644
--- a/plone/supermodel/model.py
+++ b/plone/supermodel/model.py
@@ -1,14 +1,14 @@
-import logging
-import zope.deferredimport
-from zope.component import getAdapters
-from zope.interface import Interface
-from zope.interface import implements
-from zope.interface.interface import InterfaceClass
-
-from plone.supermodel.interfaces import IModel
+# -*- coding: utf-8 -*-
from plone.supermodel.interfaces import IFieldset
+from plone.supermodel.interfaces import IModel
from plone.supermodel.interfaces import ISchema
from plone.supermodel.interfaces import ISchemaPlugin
+from zope.component import getAdapters
+from zope.interface import Interface
+from zope.interface import implementer
+from zope.interface.interface import InterfaceClass
+import logging
+import zope.deferredimport
zope.deferredimport.defineFrom('plone.supermodel.directives',
'load',
@@ -26,8 +26,8 @@
logger = logging.getLogger('plone.supermodel')
+ at implementer(IFieldset)
class Fieldset(object):
- implements(IFieldset)
def __init__(self, __name__, label=None, description=None, fields=None):
self.__name__ = __name__
@@ -43,8 +43,8 @@ def __repr__(self):
return "<Fieldset '%s' of %s>" % (self.__name__, ', '.join(self.fields))
+ at implementer(IModel)
class Model(object):
- implements(IModel)
def __init__(self, schemata=None):
if schemata is None:
@@ -58,8 +58,8 @@ def schema(self):
return self.schemata.get(u"", None)
+ at implementer(ISchema)
class SchemaClass(InterfaceClass):
- implements(ISchema)
def __init__(self, name, bases=(), attrs=None, __doc__=None,
__module__=None):
diff --git a/plone/supermodel/parser.py b/plone/supermodel/parser.py
index d9d145a..233d956 100644
--- a/plone/supermodel/parser.py
+++ b/plone/supermodel/parser.py
@@ -1,29 +1,26 @@
-import sys
-import linecache
-
+# -*- coding: utf-8 -*-
from lxml import etree
-
-from zope.interface import implements
-from zope.component import getUtility, queryUtility, getUtilitiesFor
-
-from zope.schema import getFields
-
-from zope.dottedname.resolve import resolve
-
-from plone.supermodel.interfaces import IInvariant
-from plone.supermodel.interfaces import ISchemaPolicy
+from plone.supermodel.debug import parseinfo
+from plone.supermodel.interfaces import FIELDSETS_KEY
+from plone.supermodel.interfaces import I18N_NAMESPACE
from plone.supermodel.interfaces import IFieldExportImportHandler
-
-from plone.supermodel.interfaces import ISchemaMetadataHandler
from plone.supermodel.interfaces import IFieldMetadataHandler
-
+from plone.supermodel.interfaces import IInvariant
+from plone.supermodel.interfaces import ISchemaMetadataHandler
+from plone.supermodel.interfaces import ISchemaPolicy
+from plone.supermodel.model import Fieldset
+from plone.supermodel.model import Model
+from plone.supermodel.model import Schema
+from plone.supermodel.model import SchemaClass
from plone.supermodel.utils import ns
-
-from plone.supermodel.model import Model, Fieldset, Schema, SchemaClass
-from plone.supermodel.interfaces import FIELDSETS_KEY
-from plone.supermodel.interfaces import I18N_NAMESPACE
-from plone.supermodel.debug import parseinfo
-
+from zope.component import getUtilitiesFor
+from zope.component import getUtility
+from zope.component import queryUtility
+from zope.dottedname.resolve import resolve
+from zope.interface import implementer
+from zope.schema import getFields
+import linecache
+import sys
# Exception
@@ -47,9 +44,8 @@ def __init__(self, orig_exc, fname, element):
# Helper adapters
-
+ at implementer(ISchemaPolicy)
class DefaultSchemaPolicy(object):
- implements(ISchemaPolicy)
def module(self, schemaName, tree):
return 'plone.supermodel.generated'
diff --git a/plone/supermodel/patches.py b/plone/supermodel/patches.py
index 2d4a428..785f19e 100644
--- a/plone/supermodel/patches.py
+++ b/plone/supermodel/patches.py
@@ -1,7 +1,7 @@
+# -*- coding: utf-8 -*-
import zope.interface
-import zope.schema.interfaces
-
import zope.schema
+import zope.schema.interfaces
class IDottedName(zope.interface.Interface):
diff --git a/plone/supermodel/serializer.py b/plone/supermodel/serializer.py
index 55ae942..cb91a3e 100644
--- a/plone/supermodel/serializer.py
+++ b/plone/supermodel/serializer.py
@@ -1,30 +1,28 @@
-from zope.interface import implements
-from zope.component import adapts, getUtilitiesFor
-
-from zope.schema.interfaces import IField
-
-from zope.component import queryUtility
-
+# -*- coding: utf-8 -*-
+from lxml import etree
+from plone.supermodel.interfaces import FIELDSETS_KEY
+from plone.supermodel.interfaces import I18N_NAMESPACE
from plone.supermodel.interfaces import IFieldExportImportHandler
-from plone.supermodel.interfaces import ISchemaMetadataHandler
from plone.supermodel.interfaces import IFieldMetadataHandler
-
-from plone.supermodel.interfaces import I18N_NAMESPACE
-from plone.supermodel.interfaces import XML_NAMESPACE
-from plone.supermodel.interfaces import FIELDSETS_KEY
from plone.supermodel.interfaces import IFieldNameExtractor
-
+from plone.supermodel.interfaces import ISchemaMetadataHandler
+from plone.supermodel.interfaces import XML_NAMESPACE
from plone.supermodel.model import Schema
-
-from plone.supermodel.utils import ns, sortedFields, prettyXML
-from lxml import etree
+from plone.supermodel.utils import ns
+from plone.supermodel.utils import prettyXML
+from plone.supermodel.utils import sortedFields
+from zope.component import adapter
+from zope.component import getUtilitiesFor
+from zope.component import queryUtility
+from zope.interface import implementer
+from zope.schema.interfaces import IField
+ at implementer(IFieldNameExtractor)
+ at adapter(IField)
class DefaultFieldNameExtractor(object):
"""Extract a name
"""
- implements(IFieldNameExtractor)
- adapts(IField)
def __init__(self, context):
self.context = context
diff --git a/plone/supermodel/tests.py b/plone/supermodel/tests.py
index 4e9a7ed..e47c864 100644
--- a/plone/supermodel/tests.py
+++ b/plone/supermodel/tests.py
@@ -1,23 +1,24 @@
+# -*- coding: utf-8 -*-
from cStringIO import StringIO
-import doctest
-import unittest
-
from lxml import etree
-
-from zope.interface import Interface, implements, alsoProvides, provider
-from zope.interface import Invalid
-import zope.component.testing
-
-from zope.schema import getFieldNamesInOrder
-from zope.schema.interfaces import IContextAwareDefaultFactory
-from zope.schema.interfaces import IContextSourceBinder
-from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
-from zope import schema
-
from plone.supermodel import utils
from plone.supermodel.exportimport import ChoiceHandler
from plone.supermodel.interfaces import IDefaultFactory
from plone.supermodel.interfaces import IInvariant
+from zope import schema
+from zope.interface import Interface
+from zope.interface import Invalid
+from zope.interface import alsoProvides
+from zope.interface import implementer
+from zope.interface import provider
+from zope.schema import getFieldNamesInOrder
+from zope.schema.interfaces import IContextAwareDefaultFactory
+from zope.schema.interfaces import IContextSourceBinder
+from zope.schema.vocabulary import SimpleTerm
+from zope.schema.vocabulary import SimpleVocabulary
+import doctest
+import unittest
+import zope.component.testing
def configure():
@@ -49,8 +50,8 @@ class IDummy(Interface):
title = schema.TextLine(title=u"Title")
+ at implementer(IDummy)
class Dummy(object):
- implements(IDummy)
def __init__(self):
self.title = u''
@@ -59,8 +60,8 @@ def __init__(self):
dummy1 = Dummy()
+ at implementer(IContextSourceBinder)
class Binder(object):
- implements(IContextSourceBinder)
def __init__(self):
pass
diff --git a/plone/supermodel/utils.py b/plone/supermodel/utils.py
index 34f7db2..5226662 100644
--- a/plone/supermodel/utils.py
+++ b/plone/supermodel/utils.py
@@ -1,15 +1,19 @@
-import os.path
-import sys
-import re
-
+# -*- coding: utf-8 -*-
from lxml import etree
-
-from zope.interface import directlyProvidedBy, directlyProvides
-from zope.schema.interfaces import IField, IFromUnicode, IDict, ICollection
-from zope.i18nmessageid import Message
-
-from plone.supermodel.interfaces import XML_NAMESPACE, I18N_NAMESPACE, IToUnicode
from plone.supermodel.debug import parseinfo
+from plone.supermodel.interfaces import I18N_NAMESPACE
+from plone.supermodel.interfaces import IToUnicode
+from plone.supermodel.interfaces import XML_NAMESPACE
+from zope.i18nmessageid import Message
+from zope.interface import directlyProvidedBy
+from zope.interface import directlyProvides
+from zope.schema.interfaces import ICollection
+from zope.schema.interfaces import IDict
+from zope.schema.interfaces import IField
+from zope.schema.interfaces import IFromUnicode
+import os.path
+import re
+import sys
try:
from collections import OrderedDict
diff --git a/setup.py b/setup.py
index 15a6c52..48f27cb 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,8 @@
+# -*- coding: utf-8 -*-
+from setuptools import find_packages
+from setuptools import setup
import os
import sys
-from setuptools import setup, find_packages
# if <= Python 2.6 or less, specify minimum zope.schema compatible:
@@ -21,45 +23,46 @@ def read(*rnames):
+ '\n'
)
-setup(name='plone.supermodel',
- version=version,
- description="Serialize Zope schema definitions to and from XML",
- long_description=long_description,
- # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
- classifiers=[
+setup(
+ name='plone.supermodel',
+ version=version,
+ description="Serialize Zope schema definitions to and from XML",
+ long_description=long_description,
+ # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers
+ classifiers=[
"Framework :: Plone",
"Programming Language :: Python",
"Topic :: Software Development :: Libraries :: Python Modules",
"License :: OSI Approved :: BSD License",
- ],
- keywords='Plone XML schema',
- author='Martin Aspeli',
- author_email='optilude at gmail.com',
- url='http://code.google.com/p/dexterity',
- license='BSD',
- packages=find_packages(exclude=['ez_setup']),
- namespace_packages=['plone'],
- include_package_data=True,
- zip_safe=False,
- install_requires=[
- 'setuptools',
- 'lxml',
- 'zope.component',
- 'zope.i18nmessageid',
- 'zope.interface',
- ZOPESCHEMA,
- 'zope.deferredimport',
- 'zope.dottedname',
- 'z3c.zcmlhook',
- ],
- extras_require={
+ ],
+ keywords='Plone XML schema',
+ author='Martin Aspeli',
+ author_email='optilude at gmail.com',
+ url='http://code.google.com/p/dexterity',
+ license='BSD',
+ packages=find_packages(exclude=['ez_setup']),
+ namespace_packages=['plone'],
+ include_package_data=True,
+ zip_safe=False,
+ install_requires=[
+ 'setuptools',
+ 'lxml',
+ 'zope.component',
+ 'zope.i18nmessageid',
+ 'zope.interface',
+ ZOPESCHEMA,
+ 'zope.deferredimport',
+ 'zope.dottedname',
+ 'z3c.zcmlhook',
+ ],
+ extras_require={
'lxml': [], # BBB
'plone.rfc822': ['plone.rfc822'],
'test': [
'plone.rfc822',
],
- },
- entry_points="""
- # -*- Entry points: -*-
- """,
- )
+ },
+ entry_points="""
+ # -*- Entry points: -*-
+ """,
+ )
-------------------------------------------------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CHANGES.log
Type: application/octet-stream
Size: 78473 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20141013/0a3f145a/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: build.log
Type: application/octet-stream
Size: 291679 bytes
Desc: not available
URL: <http://lists.plone.org/pipermail/plone-testbot/attachments/20141013/0a3f145a/attachment-0003.obj>
More information about the Testbot
mailing list