Skip to content

Commit

Permalink
Remove needless default factory for titleText field
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Mar 21, 2017
1 parent 1da09b4 commit 94c8085
Showing 1 changed file with 1 addition and 15 deletions.
16 changes: 1 addition & 15 deletions src/collective/newsticker/controlpanel.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
# -*- coding: utf-8 -*-
from collective.newsticker import _
from collective.newsticker.config import TITLE_TEXT
from plone import api
from plone.app.registry.browser import controlpanel
from zope import schema
from zope.interface import Interface
from zope.interface import provider
from zope.schema.interfaces import IContextAwareDefaultFactory


@provider(IContextAwareDefaultFactory)
def default_title_text(context):
# HACK: this method is to avoid "AttributeError: translate" on tests
site = api.portal.get()
if hasattr(site, 'translate'): # runtime
return site.translate(TITLE_TEXT)
else: # tests
return TITLE_TEXT


class INewsTickerSettings(Interface):
Expand Down Expand Up @@ -49,8 +36,7 @@ class INewsTickerSettings(Interface):
'help_title_text',
default=u'To remove the title set this to an empty string.'),
required=False,
defaultFactory=default_title_text,
missing_value=u'',
default=TITLE_TEXT,
)

displayType = schema.Choice(
Expand Down

0 comments on commit 94c8085

Please sign in to comment.