mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 08:02:54 +11:00
Further code quality
This commit is contained in:
parent
ef1e6c7a5d
commit
edf5adc541
2 changed files with 6 additions and 8 deletions
|
@ -58,7 +58,7 @@ class SnippetDetailView(SnippetView, DetailView):
|
||||||
slug_url_kwarg = 'snippet_id'
|
slug_url_kwarg = 'snippet_id'
|
||||||
slug_field = 'secret_id'
|
slug_field = 'secret_id'
|
||||||
|
|
||||||
def post(self, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Delete a snippet. This is allowed by anybody as long as he knows the
|
Delete a snippet. This is allowed by anybody as long as he knows the
|
||||||
snippet id. I got too many manual requests to do this, mostly for legal
|
snippet id. I got too many manual requests to do this, mostly for legal
|
||||||
|
@ -73,9 +73,9 @@ class SnippetDetailView(SnippetView, DetailView):
|
||||||
url = '{0}#'.format(reverse('snippet_new'))
|
url = '{0}#'.format(reverse('snippet_new'))
|
||||||
return HttpResponseRedirect(url)
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
return super(SnippetDetailView, self).post(*args, **kwargs)
|
return super(SnippetDetailView, self).post(request, *args, **kwargs)
|
||||||
|
|
||||||
def get(self, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
snippet = self.get_object()
|
snippet = self.get_object()
|
||||||
|
|
||||||
# One-Time snippet get deleted if the view count matches our limit
|
# One-Time snippet get deleted if the view count matches our limit
|
||||||
|
@ -88,7 +88,7 @@ class SnippetDetailView(SnippetView, DetailView):
|
||||||
snippet.view_count += 1
|
snippet.view_count += 1
|
||||||
snippet.save()
|
snippet.save()
|
||||||
|
|
||||||
return super(SnippetDetailView, self).get(*args, **kwargs)
|
return super(SnippetDetailView, self).get(request, *args, **kwargs)
|
||||||
|
|
||||||
def get_initial(self):
|
def get_initial(self):
|
||||||
snippet = self.get_object()
|
snippet = self.get_object()
|
||||||
|
@ -157,7 +157,7 @@ class SnippetHistory(TemplateView):
|
||||||
snippet_id_list = self.request.session.get('snippet_list', [])
|
snippet_id_list = self.request.session.get('snippet_list', [])
|
||||||
return Snippet.objects.filter(pk__in=snippet_id_list)
|
return Snippet.objects.filter(pk__in=snippet_id_list)
|
||||||
|
|
||||||
def post(self, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Delete all user snippets at once.
|
Delete all user snippets at once.
|
||||||
"""
|
"""
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -1,8 +1,6 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
import sys
|
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
from setuptools.command.test import test as TestCommand
|
|
||||||
|
|
||||||
long_description = u'\n\n'.join((
|
long_description = u'\n\n'.join((
|
||||||
open('README.rst').read(),
|
open('README.rst').read(),
|
||||||
|
@ -52,7 +50,7 @@ setup(
|
||||||
'coverage',
|
'coverage',
|
||||||
],
|
],
|
||||||
extras_require={
|
extras_require={
|
||||||
# Packages required for a standalone setup
|
# Packages required for a standalone setup
|
||||||
# (not integrated into an existing setup and settings)
|
# (not integrated into an existing setup and settings)
|
||||||
'standalone': {
|
'standalone': {
|
||||||
'django-csp>=3.3',
|
'django-csp>=3.3',
|
||||||
|
|
Loading…
Reference in a new issue