[Checkins] SVN: zope.preference/trunk/src/zope/preference/ PEP 8
Michael Howitz
mh at gocept.com
Thu Jan 5 13:07:08 UTC 2012
Log message for revision 123952:
PEP 8
Changed:
U zope.preference/trunk/src/zope/preference/default.py
U zope.preference/trunk/src/zope/preference/interfaces.py
U zope.preference/trunk/src/zope/preference/metadirectives.py
U zope.preference/trunk/src/zope/preference/preference.py
-=-
Modified: zope.preference/trunk/src/zope/preference/default.py
===================================================================
--- zope.preference/trunk/src/zope/preference/default.py 2012-01-05 13:04:13 UTC (rev 123951)
+++ zope.preference/trunk/src/zope/preference/default.py 2012-01-05 13:07:07 UTC (rev 123952)
@@ -15,20 +15,18 @@
$Id$
"""
-__docformat__ = "reStructuredText"
-import persistent
from BTrees.OOBTree import OOBTree
-
-import zope.interface
-import zope.component
+from zope.container.contained import Contained
+from zope.location import locate
+from zope.preference import preference, interfaces
from zope.security.checker import defineChecker
from zope.traversing.interfaces import IContainmentRoot
-from zope.location import locate
-
+import persistent
import zope.component
-from zope.container.contained import Contained
-from zope.preference import preference, interfaces
+import zope.component
+import zope.interface
+
class DefaultPreferenceProvider(persistent.Persistent, Contained):
zope.interface.implements(interfaces.IDefaultPreferenceProvider)
Modified: zope.preference/trunk/src/zope/preference/interfaces.py
===================================================================
--- zope.preference/trunk/src/zope/preference/interfaces.py 2012-01-05 13:04:13 UTC (rev 123951)
+++ zope.preference/trunk/src/zope/preference/interfaces.py 2012-01-05 13:07:07 UTC (rev 123952)
@@ -22,6 +22,7 @@
from zope.configuration.fields import MessageID
from zope.location.interfaces import ILocation
+
class IPreferenceGroup(ILocation):
"""A group of preferences.
@@ -32,7 +33,7 @@
The fields specified in the schema *must* be available as attributes and
items of the group instance. It is up to the implementation how this is
realized, however, most often one will implement __setattr__ and
- __getattr__ as well as the common mapping API.
+ __getattr__ as well as the common mapping API.
The reason all the API fields are doubly underlined is to avoid name
clashes.
@@ -67,6 +68,7 @@
prefernce groups.
"""
+
class IUserPreferences(zope.interface.Interface):
"""Objects providing this interface have to provide the root preference
group API as well."""
@@ -81,5 +83,5 @@
"""
preferences = zope.schema.Field(
- title = u"Default Preferences Root",
- description = u"Link to the default preferences")
+ title=u"Default Preferences Root",
+ description=u"Link to the default preferences")
Modified: zope.preference/trunk/src/zope/preference/metadirectives.py
===================================================================
--- zope.preference/trunk/src/zope/preference/metadirectives.py 2012-01-05 13:04:13 UTC (rev 123951)
+++ zope.preference/trunk/src/zope/preference/metadirectives.py 2012-01-05 13:07:07 UTC (rev 123952)
@@ -15,10 +15,10 @@
$Id$
"""
-__docformat__ = 'restructuredtext'
from zope.interface import Interface
from zope.configuration import fields
+
class IPreferenceGroupDirective(Interface):
"""Register a preference group."""
@@ -35,7 +35,7 @@
title=u"Schema",
description=u"Schema of the preference group used defining the "
u"preferences of the group.",
- required=False
+ required=False
)
title = fields.MessageID(
Modified: zope.preference/trunk/src/zope/preference/preference.py
===================================================================
--- zope.preference/trunk/src/zope/preference/preference.py 2012-01-05 13:04:13 UTC (rev 123951)
+++ zope.preference/trunk/src/zope/preference/preference.py 2012-01-05 13:07:07 UTC (rev 123952)
@@ -72,18 +72,17 @@
# the property to an actual value during binding, but because we overrode
# ``__setattr__`` this is not possible anymore.
__parent = None
+
@property
def __parent__(self):
return self.__parent or zope.component.hooks.getSite()
-
def __bind__(self, parent):
clone = self.__class__.__new__(self.__class__)
clone.__dict__.update(self.__dict__)
clone.__parent = parent
return clone
-
def get(self, key, default=None):
id = self.__id__ and self.__id__ + '.' + key or key
group = zope.component.queryUtility(IPreferenceGroup, id, default)
@@ -91,9 +90,8 @@
return default
return group.__bind__(self)
-
def items(self):
- cutoff = self.__id__ and len(self.__id__)+1 or 0
+ cutoff = self.__id__ and len(self.__id__) + 1 or 0
utilities = zope.component.getUtilitiesFor(IPreferenceGroup)
return [(id[cutoff:], group.__bind__(self))
for id, group in utilities
@@ -235,6 +233,7 @@
zope.interface.alsoProvides(rootGroup, IContainmentRoot)
return rootGroup
+
class preferencesNamespace(object):
"""Used to traverse to the root preferences group."""
More information about the checkins
mailing list