Skip to content

Commit

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

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/autocomplete/demo.py
M plone/formwidget/autocomplete/widget.py
Repository: plone.formwidget.autocomplete
Branch: refs/heads/master
Date: 2016-07-07T00:52:19+02:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: plone/plone.formwidget.autocomplete@2b10987

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

Use zope.interface decorator

Files changed:
M CHANGES.rst
M plone/formwidget/autocomplete/demo.py
M plone/formwidget/autocomplete/widget.py
  • Loading branch information
gforcada committed Jul 6, 2016
1 parent 9c87dea commit 4f859c0
Showing 1 changed file with 136 additions and 144 deletions.
280 changes: 136 additions & 144 deletions last_commit.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Repository: plone.folder
Repository: plone.formwidget.autocomplete


Branch: refs/heads/master
Date: 2016-07-05T23:15:44+02:00
Date: 2016-07-05T23:15:52+02:00
Author: Gil Forcada (gforcada) <gforcada@gnome.org>
Commit: https://github.com/plone/plone.folder/commit/b5c0194089982375083c516514383f4425939927
Commit: https://github.com/plone/plone.formwidget.autocomplete/commit/251a042c6a9df6054a01d8a5a8eb9b0427c69300

Use zope.interface decorator

Expand All @@ -14,193 +14,185 @@ but also makes the code python 3 compatible

Files changed:
M CHANGES.rst
M src/plone/folder/partial.py
M src/plone/folder/tests/test_integration.py
M src/plone/folder/tests/test_partialordering.py
M plone/formwidget/autocomplete/demo.py
M plone/formwidget/autocomplete/widget.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 8056e77..0e746ab 100644
index 96184bb..58d1214 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -15,7 +15,8 @@ New features:
@@ -13,6 +13,8 @@ Fixes:
- Update setup.py url to point to github.
[esteele]

Bug fixes:

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


1.0.8 (2016-04-26)
diff --git a/src/plone/folder/partial.py b/src/plone/folder/partial.py
index a77b75e..dd606d6 100644
--- a/src/plone/folder/partial.py
+++ b/src/plone/folder/partial.py
@@ -1,5 +1,5 @@
from Acquisition import aq_base
-from zope.interface import implements
+from zope.interface import implementer
1.2.9 (2016-02-09)
------------------
diff --git a/plone/formwidget/autocomplete/demo.py b/plone/formwidget/autocomplete/demo.py
index 1186b06..f62b8b3 100644
--- a/plone/formwidget/autocomplete/demo.py
+++ b/plone/formwidget/autocomplete/demo.py
@@ -3,7 +3,7 @@
from z3c.form import form, button, field
from z3c.formwidget.query.interfaces import IQuerySource
from zope.component import adapts
from zope.container.contained import notifyContainerModified

@@ -10,11 +10,11 @@
ORDER_ATTR = '_objectordering'
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
from zope import schema
from zope.schema.interfaces import IContextSourceBinder
from zope.schema.vocabulary import SimpleVocabulary
@@ -12,8 +12,8 @@
from plone.formwidget.autocomplete import AutocompleteMultiFieldWidget


+@implementer(IExplicitOrdering)
class PartialOrdering(object):
""" this implementation uses a list ot store order information on a
regular attribute of the folderish object; explicit ordering
is supported """
- implements(IExplicitOrdering)
adapts(IOrderableFolder)
+@implementer(IQuerySource)
class KeywordSource(object):
- implements(IQuerySource)

def __init__(self, context):
diff --git a/src/plone/folder/tests/test_integration.py b/src/plone/folder/tests/test_integration.py
index d6bb697..2a15e71 100644
--- a/src/plone/folder/tests/test_integration.py
+++ b/src/plone/folder/tests/test_integration.py
@@ -5,14 +5,14 @@
from plone.folder.testing import PLONEFOLDER_FUNCTIONAL_TESTING
from StringIO import StringIO
from transaction import savepoint
-from zope.interface import implements
+from zope.interface import implementer
self.context = context
@@ -42,8 +42,8 @@ def search(self, query_string):
return [self.getTerm(kw) for kw in self.keywords if q in kw.lower()]


+@implementer(IContextSourceBinder)
class KeywordSourceBinder(object):
- implements(IContextSourceBinder)

import unittest
def __call__(self, context):
return KeywordSource(context)
@@ -58,8 +58,8 @@ class ITestForm(Interface):
title=u"Multiple", source=KeywordSourceBinder()), required=False)


+@implementer(IOrderable)
class DummyFolder(OrderedBTreeFolderBase, Implicit):
""" we need to mix in acquisition """
- implements(IOrderable)
+@implementer(ITestForm)
class TestAdapter(object):
- implements(ITestForm)
adapts(Interface)

meta_type = 'DummyFolder'
def __init__(self, context):
diff --git a/plone/formwidget/autocomplete/widget.py b/plone/formwidget/autocomplete/widget.py
index ad39a12..677282c 100644
--- a/plone/formwidget/autocomplete/widget.py
+++ b/plone/formwidget/autocomplete/widget.py
@@ -10,7 +10,7 @@
import z3c.form.util
from z3c.formwidget.query.widget import QuerySourceRadioWidget
from z3c.formwidget.query.widget import QuerySourceCheckboxWidget
-from zope.interface import implementsOnly, implementer
+from zope.interface import implementer_only, implementer

from plone.formwidget.autocomplete.interfaces import IAutocompleteWidget

diff --git a/src/plone/folder/tests/test_partialordering.py b/src/plone/folder/tests/test_partialordering.py
index 4e54d85..e4e26e6 100644
--- a/src/plone/folder/tests/test_partialordering.py
+++ b/src/plone/folder/tests/test_partialordering.py
@@ -1,6 +1,6 @@
from transaction import savepoint
from Acquisition import Implicit
-from zope.interface import implements
+from zope.interface import implementer
from plone.folder.interfaces import IOrderable
from plone.folder.ordered import OrderedBTreeFolderBase
from plone.folder.partial import PartialOrdering
@@ -189,9 +189,9 @@ def testGetObjectPosition(self):
))
@@ -68,8 +68,8 @@ def __call__(self):
for t in sorted(terms, key=lambda t: t.title)])


+@implementer(IOrderable)
class DummyFolder(OrderedBTreeFolderBase, Implicit):
""" we need to mix in acquisition """
- implements(IOrderable)
+@implementer_only(IAutocompleteWidget)
class AutocompleteBase(Explicit):
- implementsOnly(IAutocompleteWidget)

meta_type = 'DummyFolder'
_ordering = u'partial'
security = ClassSecurityInfo()
security.declareObjectPublic()


Repository: plone.folder
Repository: plone.formwidget.autocomplete


Branch: refs/heads/master
Date: 2016-07-07T00:51:47+02:00
Date: 2016-07-07T00:52:19+02:00
Author: Gil Forcada Codinachs (gforcada) <gil.gnome@gmail.com>
Commit: https://github.com/plone/plone.folder/commit/ea3835fb2c7268cf0ffb184545473c88ba8a12f5
Commit: https://github.com/plone/plone.formwidget.autocomplete/commit/2b10987fb951d7103135acdf5a583dbe63cf9183

Merge pull request #4 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 src/plone/folder/partial.py
M src/plone/folder/tests/test_integration.py
M src/plone/folder/tests/test_partialordering.py
M plone/formwidget/autocomplete/demo.py
M plone/formwidget/autocomplete/widget.py

diff --git a/CHANGES.rst b/CHANGES.rst
index 8056e77..0e746ab 100644
index 96184bb..58d1214 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -15,7 +15,8 @@ New features:

Bug fixes:
@@ -13,6 +13,8 @@ Fixes:
- Update setup.py url to point to github.
[esteele]

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


1.0.8 (2016-04-26)
diff --git a/src/plone/folder/partial.py b/src/plone/folder/partial.py
index a77b75e..dd606d6 100644
--- a/src/plone/folder/partial.py
+++ b/src/plone/folder/partial.py
@@ -1,5 +1,5 @@
from Acquisition import aq_base
-from zope.interface import implements
+from zope.interface import implementer
1.2.9 (2016-02-09)
------------------
diff --git a/plone/formwidget/autocomplete/demo.py b/plone/formwidget/autocomplete/demo.py
index 1186b06..f62b8b3 100644
--- a/plone/formwidget/autocomplete/demo.py
+++ b/plone/formwidget/autocomplete/demo.py
@@ -3,7 +3,7 @@
from z3c.form import form, button, field
from z3c.formwidget.query.interfaces import IQuerySource
from zope.component import adapts
from zope.container.contained import notifyContainerModified
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
from zope import schema
from zope.schema.interfaces import IContextSourceBinder
from zope.schema.vocabulary import SimpleVocabulary
@@ -12,8 +12,8 @@
from plone.formwidget.autocomplete import AutocompleteMultiFieldWidget


@@ -10,11 +10,11 @@
ORDER_ATTR = '_objectordering'
+@implementer(IQuerySource)
class KeywordSource(object):
- implements(IQuerySource)

def __init__(self, context):
self.context = context
@@ -42,8 +42,8 @@ def search(self, query_string):
return [self.getTerm(kw) for kw in self.keywords if q in kw.lower()]


+@implementer(IContextSourceBinder)
class KeywordSourceBinder(object):
- implements(IContextSourceBinder)

def __call__(self, context):
return KeywordSource(context)
@@ -58,8 +58,8 @@ class ITestForm(Interface):
title=u"Multiple", source=KeywordSourceBinder()), required=False)


+@implementer(IExplicitOrdering)
class PartialOrdering(object):
""" this implementation uses a list ot store order information on a
regular attribute of the folderish object; explicit ordering
is supported """
- implements(IExplicitOrdering)
adapts(IOrderableFolder)
+@implementer(ITestForm)
class TestAdapter(object):
- implements(ITestForm)
adapts(Interface)

def __init__(self, context):
diff --git a/src/plone/folder/tests/test_integration.py b/src/plone/folder/tests/test_integration.py
index d6bb697..2a15e71 100644
--- a/src/plone/folder/tests/test_integration.py
+++ b/src/plone/folder/tests/test_integration.py
@@ -5,14 +5,14 @@
from plone.folder.testing import PLONEFOLDER_FUNCTIONAL_TESTING
from StringIO import StringIO
from transaction import savepoint
-from zope.interface import implements
+from zope.interface import implementer

import unittest


+@implementer(IOrderable)
class DummyFolder(OrderedBTreeFolderBase, Implicit):
""" we need to mix in acquisition """
- implements(IOrderable)

meta_type = 'DummyFolder'

diff --git a/src/plone/folder/tests/test_partialordering.py b/src/plone/folder/tests/test_partialordering.py
index 4e54d85..e4e26e6 100644
--- a/src/plone/folder/tests/test_partialordering.py
+++ b/src/plone/folder/tests/test_partialordering.py
@@ -1,6 +1,6 @@
from transaction import savepoint
from Acquisition import Implicit
-from zope.interface import implements
+from zope.interface import implementer
from plone.folder.interfaces import IOrderable
from plone.folder.ordered import OrderedBTreeFolderBase
from plone.folder.partial import PartialOrdering
@@ -189,9 +189,9 @@ def testGetObjectPosition(self):
))


+@implementer(IOrderable)
class DummyFolder(OrderedBTreeFolderBase, Implicit):
""" we need to mix in acquisition """
- implements(IOrderable)

meta_type = 'DummyFolder'
_ordering = u'partial'
diff --git a/plone/formwidget/autocomplete/widget.py b/plone/formwidget/autocomplete/widget.py
index ad39a12..677282c 100644
--- a/plone/formwidget/autocomplete/widget.py
+++ b/plone/formwidget/autocomplete/widget.py
@@ -10,7 +10,7 @@
import z3c.form.util
from z3c.formwidget.query.widget import QuerySourceRadioWidget
from z3c.formwidget.query.widget import QuerySourceCheckboxWidget
-from zope.interface import implementsOnly, implementer
+from zope.interface import implementer_only, implementer

from plone.formwidget.autocomplete.interfaces import IAutocompleteWidget

@@ -68,8 +68,8 @@ def __call__(self):
for t in sorted(terms, key=lambda t: t.title)])


+@implementer_only(IAutocompleteWidget)
class AutocompleteBase(Explicit):
- implementsOnly(IAutocompleteWidget)

security = ClassSecurityInfo()
security.declareObjectPublic()


0 comments on commit 4f859c0

Please sign in to comment.