Skip to content

Commit

Permalink
integrate changes from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
thet committed Apr 3, 2014
1 parent 6c211d9 commit 92c8349
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 36 deletions.
4 changes: 2 additions & 2 deletions src/z3c/form/events.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from z3c.form.interfaces import IDataExtractedEvent
from zope.interface import implements
import zope.interface


@zope.interface.implementer(IDataExtractedEvent)
class DataExtractedEvent(object):
implements(IDataExtractedEvent)

def __init__(self, data, errors, form):
self.data = data
Expand Down
2 changes: 1 addition & 1 deletion src/z3c/form/group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#########################################################################
##############################################################################
#
# Copyright (c) 2007 Zope Foundation and Contributors.
# All Rights Reserved.
Expand Down
5 changes: 4 additions & 1 deletion src/z3c/form/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,5 +1122,8 @@ class IAfterWidgetUpdateEvent(IWidgetEvent):


class IDataExtractedEvent(zope.interface.Interface):
"""Event thrown after data and errors are extracted from widgets.
"""Event sent after data and errors are extracted from widgets.
"""
data = zope.interface.Attribute("Extracted form data")
errors = zope.interface.Attribute("List of errors")
form = zope.interface.Attribute("Form instance")
65 changes: 33 additions & 32 deletions src/z3c/form/tests/test_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@
import itertools
import re
import unittest
from zope.testing import renormalizing

from zope.testing import renormalizing
from z3c.form import testing

# This package will allways provide z3c.pt for it's test setup.
# The Z3CPT_AVAILABLE hickup is usefull if someone will run the z3c.form tests
# in his own project and doesn't use z3c.pt.
try:
import z3c.pt
import z3c.ptcompat
import z3c.ptcompat # nopep8
Z3CPT_AVAILABLE = True
except ImportError:
Z3CPT_AVAILABLE = False

try:
import zope.app.container
import zope.app.container # nopep8
except ImportError:
ADDING_AVAILABLE = False
else:
ADDING_AVAILABLE = True


def test_suite():
flags = \
doctest.NORMALIZE_WHITESPACE | \
Expand All @@ -54,103 +55,103 @@ def test_suite():
'../form.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../action.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../datamanager.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../field.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../contentprovider.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../validator.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../error.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../widget.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../button.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../zcml.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../testing.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../converter.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=renormalizing.RENormalizing([
(re.compile(
r"(invalid literal for int\(\)) with base 10: '(.*)'"),
r'\1: \2'),
(re.compile(
r"Decimal\('(.*)'\)"),
r'Decimal("\1")'),
]) + testing.outputChecker
),
(re.compile(
r"(invalid literal for int\(\)) with base 10: '(.*)'"),
r'\1: \2'),
(re.compile(
r"Decimal\('(.*)'\)"),
r'Decimal("\1")'),
]) + testing.outputChecker
),
doctest.DocFileSuite(
'../group.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../subform.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../term.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../util.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),
),
doctest.DocFileSuite(
'../hint.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
))
))
for setUp in setups)

if ADDING_AVAILABLE:
tests = itertools.chain(tests, ((
doctest.DocFileSuite(
'../adding.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
doctest.DocFileSuite(
'../adding.txt',
setUp=setUp, tearDown=testing.tearDown,
optionflags=flags, checker=testing.outputChecker,
),)
for setUp in setups))
for setUp in setups))

return unittest.TestSuite(itertools.chain(*tests))

0 comments on commit 92c8349

Please sign in to comment.