Code quality

This commit is contained in:
Martin Mahner 2018-04-29 11:23:54 +02:00
parent b5f4213535
commit ef1e6c7a5d
5 changed files with 6 additions and 25 deletions

View file

@ -20,6 +20,7 @@ before_install:
- coverage erase - coverage erase
install: install:
- npm install
- pip install $DJANGO - pip install $DJANGO
- pip install -e .[standalone] - pip install -e .[standalone]

View file

@ -90,6 +90,5 @@ if (clipboardLink && copyToClipboardField) {
e.preventDefault(); e.preventDefault();
copyToClipboardField.select(); copyToClipboardField.select();
document.execCommand("Copy"); document.execCommand("Copy");
console.log('Copied URL to clipboard:', copyToClipboardField.value);
}; };
} }

View file

@ -1,6 +1,3 @@
import sys
from optparse import make_option
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone

View file

@ -238,7 +238,7 @@ class APIView(View):
lexer = request.POST.get('lexer', highlight.LEXER_DEFAULT).strip() lexer = request.POST.get('lexer', highlight.LEXER_DEFAULT).strip()
filename = request.POST.get('filename', '').strip() filename = request.POST.get('filename', '').strip()
expires = request.POST.get('expires', '').strip() expires = request.POST.get('expires', '').strip()
format = request.POST.get('format', 'default').strip() response_format = request.POST.get('format', 'default').strip()
if not content.strip(): if not content.strip():
return HttpResponseBadRequest('No content given') return HttpResponseBadRequest('No content given')
@ -281,10 +281,10 @@ class APIView(View):
) )
s.save() s.save()
if not format in FORMAT_MAPPING: if not response_format in FORMAT_MAPPING:
response = _format_default(s) response = _format_default(s)
else: else:
response = FORMAT_MAPPING[format](s) response = FORMAT_MAPPING[response_format](s)
return HttpResponse(response) return HttpResponse(response)

View file

@ -1,22 +1,9 @@
#!/usr/bin/env python #!/usr/bin/env python
from sys import exit import sys
from setuptools import find_packages, setup from setuptools import find_packages, setup
from setuptools.command.test import test as TestCommand from setuptools.command.test import test as TestCommand
class Tox(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
#import here, cause outside the eggs aren't loaded
import tox
errno = tox.cmdline(self.test_args)
exit(errno)
long_description = u'\n\n'.join(( long_description = u'\n\n'.join((
open('README.rst').read(), open('README.rst').read(),
open('CHANGELOG').read() open('CHANGELOG').read()
@ -70,8 +57,5 @@ setup(
'standalone': { 'standalone': {
'django-csp>=3.3', 'django-csp>=3.3',
} }
}, }
cmdclass={
'test': Tox
},
) )