diff --git a/dpaste/forms.py b/dpaste/forms.py index a88fe5c..9fcb0d9 100644 --- a/dpaste/forms.py +++ b/dpaste/forms.py @@ -79,7 +79,7 @@ class SnippetForm(forms.ModelForm): def clean_content(self): content = self.cleaned_data.get('content', '') - if content.strip() == '': + if not content.strip(): raise forms.ValidationError(_('This field is required.')) return content diff --git a/dpaste/highlight.py b/dpaste/highlight.py index 386b116..ec20a39 100644 --- a/dpaste/highlight.py +++ b/dpaste/highlight.py @@ -117,8 +117,7 @@ class NakedHtmlFormatter(HtmlFormatter): return self._wrap_code(source) def _wrap_code(self, source): - for i, t in source: - yield i, t + yield from source class PlainCodeHighlighter(Highlighter): diff --git a/dpaste/views.py b/dpaste/views.py index c2ec679..faf6d38 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -260,7 +260,7 @@ class APIView(View): lexer = config.PLAIN_CODE_SYMBOL if expires: - expire_options = [str(i) for i in dict(config.EXPIRE_CHOICES).keys()] + expire_options = [str(i) for i in dict(config.EXPIRE_CHOICES)] if expires not in expire_options: return HttpResponseBadRequest( 'Invalid expire choice "{}" given. Valid values are: {}'.format(