[Zope3-checkins] SVN: zope.formlib/branches/faassen-zaf/src/zope/formlib/ Some cleanups thanks to pyflakes.
Martijn Faassen
faassen at startifact.com
Wed Dec 30 15:21:02 EST 2009
Log message for revision 107383:
Some cleanups thanks to pyflakes.
Changed:
U zope.formlib/branches/faassen-zaf/src/zope/formlib/boolwidgets.py
U zope.formlib/branches/faassen-zaf/src/zope/formlib/interfaces.py
U zope.formlib/branches/faassen-zaf/src/zope/formlib/itemswidgets.py
U zope.formlib/branches/faassen-zaf/src/zope/formlib/tests.py
U zope.formlib/branches/faassen-zaf/src/zope/formlib/utility.py
U zope.formlib/branches/faassen-zaf/src/zope/formlib/widget.py
-=-
Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/boolwidgets.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/boolwidgets.py 2009-12-30 20:10:52 UTC (rev 107382)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/boolwidgets.py 2009-12-30 20:21:02 UTC (rev 107383)
@@ -17,7 +17,6 @@
"""
__docformat__ = 'restructuredtext'
-from zope.interface import implements
from zope.schema.vocabulary import SimpleVocabulary
from zope.formlib.widget import SimpleInputWidget, renderElement
@@ -25,7 +24,6 @@
from zope.formlib.i18n import _
from zope.formlib.itemswidgets import RadioWidget
from zope.formlib.itemswidgets import SelectWidget, DropdownWidget
-from zope.formlib.interfaces import IInputWidget
class CheckBoxWidget(SimpleInputWidget):
Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/interfaces.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/interfaces.py 2009-12-30 20:10:52 UTC (rev 107382)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/interfaces.py 2009-12-30 20:21:02 UTC (rev 107383)
@@ -19,7 +19,7 @@
from zope.publisher.interfaces.browser import IBrowserPage
from zope.schema.interfaces import ValidationError
from zope.publisher.interfaces import IView
-from zope.interface import Attribute, Interface, implements
+from zope.interface import Attribute, Interface, implements, Invalid
from zope.schema import Bool
from zope.exceptions.interfaces import UserError
@@ -293,14 +293,15 @@
u'If True, an empty string is converted to field.missing_value.',
default=True)
-
+# XXX this seems to be buggy (since at least 2005)
+# it returns None, and prefix_re is never defined.
def reConstraint(pat, explanation):
pat = re.compile(pat)
def constraint(value):
if prefix_re.match(value):
return True
- raise interface.Invalid(value, explanation)
+ raise Invalid(value, explanation)
class IWidgetInputErrorView(Interface):
"""Display an input error as a snippet of text."""
Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/itemswidgets.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/itemswidgets.py 2009-12-30 20:10:52 UTC (rev 107382)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/itemswidgets.py 2009-12-30 20:21:02 UTC (rev 107383)
@@ -21,8 +21,8 @@
from zope import component
from zope.interface import implements
from zope.i18n import translate
-from zope.schema.interfaces import ValidationError, InvalidValue
-from zope.schema.interfaces import ConstraintNotSatisfied, ITitledTokenizedTerm
+from zope.schema.interfaces import InvalidValue
+from zope.schema.interfaces import ITitledTokenizedTerm
from zope.formlib.widget import SimpleInputWidget, renderElement
from zope.formlib.interfaces import IInputWidget, IDisplayWidget
@@ -120,7 +120,7 @@
for token in tokens:
try:
term = self.vocabulary.getTermByToken(token)
- except LookupError, error:
+ except LookupError:
raise InvalidValue("token %r not found in vocabulary" % token)
else:
values.append(term.value)
@@ -335,7 +335,6 @@
"""See IBrowserWidget."""
value = self._getFormValue()
contents = []
- have_results = False
contents.append(self._div('value', self.renderValue(value)))
contents.append(self._emptyMarker())
Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/tests.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/tests.py 2009-12-30 20:10:52 UTC (rev 107382)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/tests.py 2009-12-30 20:21:02 UTC (rev 107383)
@@ -21,8 +21,7 @@
from zope.component.testing import setUp, tearDown
from zope.component import adapter
from zope.component import adapts
-from zope.component import provideAdapter
-from zope.component import provideUtility
+from zope.component import provideAdapter, provideUtility
from zope.i18n.testing import setUp as i18nSetUp
import zope.interface.common.idatetime
Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/utility.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/utility.py 2009-12-30 20:10:52 UTC (rev 107382)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/utility.py 2009-12-30 20:21:02 UTC (rev 107383)
@@ -23,16 +23,11 @@
__docformat__ = 'restructuredtext'
from zope import component
-from zope import security
-from zope.security.proxy import Proxy
-from zope.proxy import isProxy
-from zope.interface.interfaces import IMethod
-from zope.security.interfaces import ForbiddenAttribute, Unauthorized
from zope.schema import getFieldsInOrder
from zope.formlib.interfaces import IWidget
-from zope.formlib.interfaces import WidgetsError, MissingInputError
+from zope.formlib.interfaces import WidgetsError
from zope.formlib.interfaces import InputErrors
-from zope.formlib.interfaces import IInputWidget, IDisplayWidget
+from zope.formlib.interfaces import IInputWidget
from zope.formlib.interfaces import IWidgetFactory
# A marker that indicates 'no value' for any of the utility functions that
Modified: zope.formlib/branches/faassen-zaf/src/zope/formlib/widget.py
===================================================================
--- zope.formlib/branches/faassen-zaf/src/zope/formlib/widget.py 2009-12-30 20:10:52 UTC (rev 107382)
+++ zope.formlib/branches/faassen-zaf/src/zope/formlib/widget.py 2009-12-30 20:21:02 UTC (rev 107383)
@@ -25,13 +25,12 @@
from zope.publisher.browser import BrowserView
from zope.formlib.interfaces import ConversionError
-from zope.formlib.interfaces import InputErrors
from zope.formlib.interfaces import WidgetInputError, MissingInputError
from zope.formlib.interfaces import IBrowserWidget
from zope.formlib.interfaces import ISimpleInputWidget
from zope.formlib.interfaces import IWidgetInputErrorView
from zope.formlib.interfaces import IWidget, InputErrors, IWidgetFactory
-from zope.interface import implements
+
from zope.i18n import translate
from zope.schema.interfaces import IChoice, ICollection
More information about the Zope3-Checkins
mailing list