Skip to content

Commit

Permalink
[fc] Repository: plone.formwidget.datetime
Browse files Browse the repository at this point in the history
Branch: refs/heads/master
Date: 2016-07-05T23:16:07+02:00
Author: Gil Forcada (gforcada) <gforcada@gnome.org>
Commit: plone/plone.formwidget.datetime@64123d6

Use zope.interface decorator

This not only makes code more pleasent to read,
but also makes the code python 3 compatible
(while maintaining python 2 compatibility).

Files changed:
M CHANGES.rst
M plone/formwidget/datetime/setuphandlers.py
M plone/formwidget/datetime/z3cform/widget.py
Repository: plone.formwidget.datetime
Branch: refs/heads/master
Date: 2016-07-07T00:58:49+02:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: plone/plone.formwidget.datetime@5b7c123

Merge pull request #18 from plone/gforcada-use-zope-decorators

Use zope.interface decorator

Files changed:
M CHANGES.rst
M plone/formwidget/datetime/setuphandlers.py
M plone/formwidget/datetime/z3cform/widget.py
  • Loading branch information
gforcada committed Jul 6, 2016
1 parent 828749e commit 7a63290
Showing 1 changed file with 149 additions and 89 deletions.
238 changes: 149 additions & 89 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Repository: plone.keyring
Repository: plone.formwidget.datetime


Branch: refs/heads/master
Date: 2016-07-05T23:16:43+02:00
Date: 2016-07-05T23:16:07+02:00
Author: Gil Forcada (gforcada) <gforcada@gnome.org>
Commit: https://github.com/plone/plone.keyring/commit/4f560e5959082bf57571d8fb600191ab2f383245
Commit: https://github.com/plone/plone.formwidget.datetime/commit/64123d645cc11d89fbd2c62f5a64d79e3d77b471

Use zope.interface decorator

Expand All @@ -14,145 +14,205 @@ but also makes the code python 3 compatible

Files changed:
M CHANGES.rst
M plone/keyring/keymanager.py
M plone/keyring/keyring.py
M plone/formwidget/datetime/setuphandlers.py
M plone/formwidget/datetime/z3cform/widget.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 7c66550..5921bba 100644
index f91454b..95caa5d 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -11,7 +11,8 @@ New:
@@ -12,6 +12,8 @@ Fixes:

Fixes:
- Marked in setup.py as also compatible with Plone 4.3, next to 5.0. [maurits]

-- *add item here*
+- Use zope.interface decorator.
+ [gforcada]


3.0.1 (2015-05-11)
diff --git a/plone/keyring/keymanager.py b/plone/keyring/keymanager.py
index 68d7fe6..16989c4 100644
--- a/plone/keyring/keymanager.py
+++ b/plone/keyring/keymanager.py
@@ -1,13 +1,13 @@
from persistent.mapping import PersistentMapping
from zope.container.sample import SampleContainer
1.3 (2016-02-11)
----------------
diff --git a/plone/formwidget/datetime/setuphandlers.py b/plone/formwidget/datetime/setuphandlers.py
index 9eb63e3..b936267 100644
--- a/plone/formwidget/datetime/setuphandlers.py
+++ b/plone/formwidget/datetime/setuphandlers.py
@@ -1,9 +1,9 @@
-from zope.interface import implements
+from zope.interface import implementer
from Products.CMFPlone.interfaces import INonInstallable

from plone.keyring.interfaces import IKeyManager
from plone.keyring.keyring import Keyring

+@implementer(INonInstallable)
class HiddenProfiles(object):
- implements(INonInstallable)

+@implementer(IKeyManager)
class KeyManager(SampleContainer):
- implements(IKeyManager)
def getNonInstallableProfiles(self):
"""Prevents profiles, which should not be user-installable from showing
diff --git a/plone/formwidget/datetime/z3cform/widget.py b/plone/formwidget/datetime/z3cform/widget.py
index 0300440..2882362 100644
--- a/plone/formwidget/datetime/z3cform/widget.py
+++ b/plone/formwidget/datetime/z3cform/widget.py
@@ -11,7 +11,7 @@
from z3c.form.widget import FieldWidget
from zope.component import adapter
from zope.i18n.format import DateTimeParseError
-from zope.interface import implementer, implementsOnly
+from zope.interface import implementer, implementer_only
from zope.schema.interfaces import IField

def __init__(self, keyring_size=5):
SampleContainer.__init__(self)
diff --git a/plone/keyring/keyring.py b/plone/keyring/keyring.py
index da50011..dad8107 100644
--- a/plone/keyring/keyring.py
+++ b/plone/keyring/keyring.py
@@ -2,7 +2,7 @@
from random import choice

from persistent.list import PersistentList
-from zope.interface import implements
+from zope.interface import implementer
from zope.location.interfaces import IContained
@@ -52,12 +52,12 @@ def update(self):
addFieldClass(self)


+@implementer_only(IDateWidget)
class DateWidget(base.AbstractDateWidget, AbstractDXDateWidget):
""" Date widget.
Please note: zope.schema date/datetime field values are python datetime
instances.
"""
- implementsOnly(IDateWidget)


@implementer(IFieldWidget)
@@ -67,9 +67,9 @@ def DateFieldWidget(field, request):
return FieldWidget(field, DateWidget(request))


+@implementer_only(IDatetimeWidget)
class DatetimeWidget(base.AbstractDatetimeWidget, AbstractDXDateWidget):
""" DateTime widget """
- implementsOnly(IDatetimeWidget)

def extract(self, default=NOVALUE):
# get normal input fields
@@ -133,9 +133,9 @@ def DatetimeFieldWidget(field, request):
return FieldWidget(field, DatetimeWidget(request))


from plone.keyring.interfaces import IKeyring
@@ -13,10 +13,9 @@ def GenerateSecret(length=64):
return django_random.get_random_string(length)
+@implementer_only(IMonthYearWidget)
class MonthYearWidget(base.AbstractMonthYearWidget, AbstractDXDateWidget):
""" Month and year widget """
- implementsOnly(IMonthYearWidget)

def extract(self, default=NOVALUE):
day = self.request.get(self.name + '-day', default)
@@ -155,9 +155,9 @@ def MonthYearFieldWidget(field, request):
return FieldWidget(field, MonthYearWidget(request))

+@implementer(IKeyring, IContained)
class Keyring(PersistentList):

- implements(IKeyring, IContained)
-
__parent__ = __name__ = None
+@implementer_only(IYearWidget)
class YearWidget(base.AbstractYearWidget, AbstractDXDateWidget):
""" Year widget """
- implementsOnly(IYearWidget)

last_rotation = 0
def extract(self, default=NOVALUE):
day = self.request.get(self.name + '-day', default)


Repository: plone.keyring
Repository: plone.formwidget.datetime


Branch: refs/heads/master
Date: 2016-07-07T00:57:56+02:00
Date: 2016-07-07T00:58:49+02:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: https://github.com/plone/plone.keyring/commit/38af501b10d73a9c5d36cac187eedf6c063ec1e2
Commit: https://github.com/plone/plone.formwidget.datetime/commit/5b7c123ca7cdfa3c40fc77a6457abaae88ade4f2

Merge pull request #3 from plone/gforcada-use-zope-decorators
Merge pull request #18 from plone/gforcada-use-zope-decorators

Use zope.interface decorator

Files changed:
M CHANGES.rst
M plone/keyring/keymanager.py
M plone/keyring/keyring.py
M plone/formwidget/datetime/setuphandlers.py
M plone/formwidget/datetime/z3cform/widget.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 7c66550..5921bba 100644
index f91454b..95caa5d 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -11,7 +11,8 @@ New:
@@ -12,6 +12,8 @@ Fixes:

Fixes:
- Marked in setup.py as also compatible with Plone 4.3, next to 5.0. [maurits]

-- *add item here*
+- Use zope.interface decorator.
+ [gforcada]


3.0.1 (2015-05-11)
diff --git a/plone/keyring/keymanager.py b/plone/keyring/keymanager.py
index 68d7fe6..16989c4 100644
--- a/plone/keyring/keymanager.py
+++ b/plone/keyring/keymanager.py
@@ -1,13 +1,13 @@
from persistent.mapping import PersistentMapping
from zope.container.sample import SampleContainer
1.3 (2016-02-11)
----------------
diff --git a/plone/formwidget/datetime/setuphandlers.py b/plone/formwidget/datetime/setuphandlers.py
index 9eb63e3..b936267 100644
--- a/plone/formwidget/datetime/setuphandlers.py
+++ b/plone/formwidget/datetime/setuphandlers.py
@@ -1,9 +1,9 @@
-from zope.interface import implements
+from zope.interface import implementer
from Products.CMFPlone.interfaces import INonInstallable

from plone.keyring.interfaces import IKeyManager
from plone.keyring.keyring import Keyring

+@implementer(INonInstallable)
class HiddenProfiles(object):
- implements(INonInstallable)

+@implementer(IKeyManager)
class KeyManager(SampleContainer):
- implements(IKeyManager)
def getNonInstallableProfiles(self):
"""Prevents profiles, which should not be user-installable from showing
diff --git a/plone/formwidget/datetime/z3cform/widget.py b/plone/formwidget/datetime/z3cform/widget.py
index 0300440..2882362 100644
--- a/plone/formwidget/datetime/z3cform/widget.py
+++ b/plone/formwidget/datetime/z3cform/widget.py
@@ -11,7 +11,7 @@
from z3c.form.widget import FieldWidget
from zope.component import adapter
from zope.i18n.format import DateTimeParseError
-from zope.interface import implementer, implementsOnly
+from zope.interface import implementer, implementer_only
from zope.schema.interfaces import IField

def __init__(self, keyring_size=5):
SampleContainer.__init__(self)
diff --git a/plone/keyring/keyring.py b/plone/keyring/keyring.py
index da50011..dad8107 100644
--- a/plone/keyring/keyring.py
+++ b/plone/keyring/keyring.py
@@ -2,7 +2,7 @@
from random import choice

from persistent.list import PersistentList
-from zope.interface import implements
+from zope.interface import implementer
from zope.location.interfaces import IContained
@@ -52,12 +52,12 @@ def update(self):
addFieldClass(self)


+@implementer_only(IDateWidget)
class DateWidget(base.AbstractDateWidget, AbstractDXDateWidget):
""" Date widget.
Please note: zope.schema date/datetime field values are python datetime
instances.
"""
- implementsOnly(IDateWidget)


@implementer(IFieldWidget)
@@ -67,9 +67,9 @@ def DateFieldWidget(field, request):
return FieldWidget(field, DateWidget(request))


+@implementer_only(IDatetimeWidget)
class DatetimeWidget(base.AbstractDatetimeWidget, AbstractDXDateWidget):
""" DateTime widget """
- implementsOnly(IDatetimeWidget)

def extract(self, default=NOVALUE):
# get normal input fields
@@ -133,9 +133,9 @@ def DatetimeFieldWidget(field, request):
return FieldWidget(field, DatetimeWidget(request))


from plone.keyring.interfaces import IKeyring
@@ -13,10 +13,9 @@ def GenerateSecret(length=64):
return django_random.get_random_string(length)
+@implementer_only(IMonthYearWidget)
class MonthYearWidget(base.AbstractMonthYearWidget, AbstractDXDateWidget):
""" Month and year widget """
- implementsOnly(IMonthYearWidget)

def extract(self, default=NOVALUE):
day = self.request.get(self.name + '-day', default)
@@ -155,9 +155,9 @@ def MonthYearFieldWidget(field, request):
return FieldWidget(field, MonthYearWidget(request))

+@implementer(IKeyring, IContained)
class Keyring(PersistentList):

- implements(IKeyring, IContained)
-
__parent__ = __name__ = None
+@implementer_only(IYearWidget)
class YearWidget(base.AbstractYearWidget, AbstractDXDateWidget):
""" Year widget """
- implementsOnly(IYearWidget)

last_rotation = 0
def extract(self, default=NOVALUE):
day = self.request.get(self.name + '-day', default)


0 comments on commit 7a63290

Please sign in to comment.