Skip to content

Commit

Permalink
don't validate canned responses, we don't care about them (bug 649569)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy McKay committed Apr 13, 2011
1 parent 367c48c commit 9157bd3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
8 changes: 7 additions & 1 deletion apps/editors/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,19 @@ def label_from_instance(self, addon_file):
file_review_status(addon, addon_file)))


class NonValidatingChoiceField(forms.ChoiceField):
"""A ChoiceField that doesn't validate."""
def validate(self, value):
pass


class ReviewAddonForm(happyforms.Form):
addon_files = AddonFilesMultipleChoiceField(required=False,
queryset=File.objects.none(), label=_lazy('Files:'),
widget=forms.CheckboxSelectMultiple())
comments = forms.CharField(required=True, widget=forms.Textarea(),
label=_lazy('Comments:'))
canned_response = forms.ChoiceField(required=False)
canned_response = NonValidatingChoiceField(required=False)
action = forms.ChoiceField(required=True, widget=forms.RadioSelect())
operating_systems = forms.CharField(required=False,
label=_lazy('Operating systems:'))
Expand Down
4 changes: 0 additions & 4 deletions apps/editors/templates/editors/review.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ <h3 id="validation">
<div class="review-actions-section review-actions-save">
<input type="submit" value="{{ _('Save') }}" />
</div>
<div class="hidden">
Non form errors: {{ form.non_form_errors }}
Errors: {{ form.errors }}
</div>
</div>
</div>
</form>
Expand Down
8 changes: 8 additions & 0 deletions apps/editors/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,6 +908,14 @@ def test_info_requested(self):
eq_(len(mail.outbox), 1)
self.assertTemplateUsed(response, 'editors/emails/info.ltxt')

def test_info_requested_canned_response(self):
response = self.client.post(self.url, {'action': 'info',
'comments': 'hello sailor',
'canned_response': 'foo'})
eq_(response.status_code, 302)
eq_(len(mail.outbox), 1)
self.assertTemplateUsed(response, 'editors/emails/info.ltxt')

def test_notify(self):
response = self.client.post(self.url, {'action': 'info',
'comments': 'hello sailor',
Expand Down

0 comments on commit 9157bd3

Please sign in to comment.