Skip to content

Commit

Permalink
Removed trailing whitespace.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Mar 3, 2012
1 parent 8e59372 commit 07a2e69
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/test_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -797,5 +797,5 @@ def test_request_post_valid(self):
r = self.widget().request(req)
assert (
r.body == """Form posted successfully {'field2': 'b', 'field3': 'c', 'field1': 'a'}""" or
r.body == """Form posted successfully {'field2': u'b', 'field3': u'c', 'field1': u'a'}"""
r.body == """Form posted successfully {'field2': u'b', 'field3': u'c', 'field1': u'a'}"""
), r.body
2 changes: 1 addition & 1 deletion tw2/forms/calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get_calendar_lang_file_link(self, lang):
def __init__(self, *args, **kw):
if self.validator is None:
self.validator = twc.DateTimeValidator(
format=self.date_format,
format=self.date_format,
)
super(CalendarDatePicker, self).__init__(*args, **kw)

Expand Down
18 changes: 9 additions & 9 deletions tw2/forms/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def validate_python(self, value, outer_call=None):
if isinstance(value, cgi.FieldStorage):
if self.extension is not None and not value.filename.endswith(self.extension):
raise twc.ValidationError('badext', self)
elif value:
elif value:
raise twc.ValidationError('corrupt', self)
elif self.required:
raise twc.ValidationError('required', self)
Expand Down Expand Up @@ -185,13 +185,13 @@ class SelectionField(FormField):
* A list of values, e.g.
``['', 'Red', 'Blue']``
* A list of (code, value) tuples, e.g.
* A list of (code, value) tuples, e.g.
``[(0, ''), (1, 'Red'), (2, 'Blue')]``
* A mixed list of values and tuples. If the code is not specified, it defaults to the value. e.g.
* A mixed list of values and tuples. If the code is not specified, it defaults to the value. e.g.
``['', (1, 'Red'), (2, 'Blue')]``
* Attributes can be specified for individual items, e.g.
* Attributes can be specified for individual items, e.g.
``[(1, 'Red', {'style':'background-color:red'})]``
* A list of groups, e.g.
* A list of groups, e.g.
``[('group1', [(1, 'Red')]), ('group2', ['Pink', 'Yellow'])]``
"""

Expand All @@ -208,7 +208,7 @@ def prepare(self):
self.options = []
self.grouped_options = []
counter = itertools.count(0)

for optgroup in self._iterate_options(options):
opts = []
group = isinstance(optgroup[1], (list,tuple))
Expand All @@ -220,18 +220,18 @@ def prepare(self):
option_attrs['value'] = option[0]
if self.field_type:
option_attrs['type'] = self.field_type
option_attrs['name'] = self.compound_id
option_attrs['name'] = self.compound_id
option_attrs['id'] = self.compound_id + ':' + str(counter.next())
if self._opt_matches_value(option[0]):
option_attrs[self.selected_verb] = self.selected_verb
opts.append((option_attrs, option[1]))
self.options.extend(opts)
if group:
self.grouped_options.append((unicode(optgroup[0]), opts))
self.grouped_options.append((unicode(optgroup[0]), opts))

if self.prompt_text is not None:
self.options = [('', self.prompt_text)] + self.options
if not self.grouped_options:
if not self.grouped_options:
self.grouped_options = [(None, self.options)]
elif self.prompt_text is not None:
self.grouped_options = [(None, [('', self.prompt_text)])] + self.grouped_options
Expand Down

0 comments on commit 07a2e69

Please sign in to comment.