-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #63 from plone/gforcada-use-zope-decorators
Use zope.interface decorator
- Loading branch information
Showing
5 changed files
with
15 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
# -*- coding: utf8 -*- | ||
|
||
from zope.interface import implements | ||
from zope.interface import implementer | ||
from plone.app.querystring.interfaces import IParsedQueryIndexModifier | ||
|
||
|
||
@implementer(IParsedQueryIndexModifier) | ||
class SimpleFooIndexModifier(object): | ||
"""Test simple index modifier that do nothing""" | ||
|
||
implements(IParsedQueryIndexModifier) | ||
|
||
def __call__(self, value): | ||
raise Exception("SimpleFooIndexModifier has been called!") | ||
|
||
|
||
@implementer(IParsedQueryIndexModifier) | ||
class TitleFooIndexModifier(object): | ||
"""Test index modifier that check always Foo""" | ||
|
||
implements(IParsedQueryIndexModifier) | ||
|
||
def __call__(self, value): | ||
return ('Title', 'Foo') | ||
|
||
|
||
@implementer(IParsedQueryIndexModifier) | ||
class AbstractToDescriptionIndexModifier(object): | ||
""" | ||
Test index modifier that translate "Abstract" to Description index | ||
but where value do not count letter "e" | ||
""" | ||
|
||
implements(IParsedQueryIndexModifier) | ||
|
||
def __call__(self, value): | ||
value['query'] = value['query'].replace('e', '') | ||
return ('Description', value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters