From f06761c1ff890e06934989f702766f468cc497c4 Mon Sep 17 00:00:00 2001 From: ABDUL NIYAS P M Date: Tue, 11 Dec 2018 23:26:30 +0530 Subject: [PATCH] minor fixes (#114) --- dpaste/forms.py | 2 +- dpaste/highlight.py | 3 +-- dpaste/views.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dpaste/forms.py b/dpaste/forms.py index 4091a0b..87e9815 100644 --- a/dpaste/forms.py +++ b/dpaste/forms.py @@ -66,7 +66,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 4e7a2b7..770c203 100644 --- a/dpaste/highlight.py +++ b/dpaste/highlight.py @@ -114,8 +114,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 b036f5a..601b100 100644 --- a/dpaste/views.py +++ b/dpaste/views.py @@ -257,7 +257,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(