Settiings check and cleanup.

This commit is contained in:
Martin Mahner 2018-06-23 15:17:03 +02:00
parent cd81a68182
commit 99629d6cd6
2 changed files with 31 additions and 34 deletions

View file

@ -51,15 +51,11 @@ USE_L10N = False
LANGUAGE_CODE = 'en'
LANGUAGES = (
('en', 'English'),
# ('de', 'German'),
# ('es', 'Spanish'),
# ('pt-br', 'Portugese (Brasil)'),
# ('fr', 'French'),
)
LOCALE_PATHS = (
os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'locale')),
)
# LOCALE_PATHS = (
# os.path.abspath(os.path.join(os.path.dirname(__file__), '..', 'locale')),
# )
# ==============================================================================
# Project URLS and media settings
@ -123,14 +119,14 @@ INSTALLED_APPS = [
'dpaste.apps.dpasteAppConfig',
]
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'dev.db',
'USER': '',
'PASSWORD': '',
}
}
# DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': 'dev.db',
# 'USER': '',
# 'PASSWORD': '',
# }
# }
# ==============================================================================
# App specific settings

View file

@ -230,9 +230,9 @@ class APIView(View):
return HttpResponseBadRequest('Invalid lexer "%s" given. Valid lexers are: %s' % (
lexer, ', '.join(highlight.LEXER_KEYS)))
# No lexer is given, but we have a filename, try to get the lexer out of it.
# In case Pygments cannot determine the lexer of the filename, we fallback
# to 'plain' code.
# No lexer is given, but we have a filename, try to get the lexer
# out of it. In case Pygments cannot determine the lexer of the
# filename, we fallback to 'plain' code.
if not lexer and filename:
try:
lexer_cls = get_lexer_for_filename(filename)
@ -242,9 +242,10 @@ class APIView(View):
if expires:
expire_options = [str(i) for i in dict(config.EXPIRE_CHOICES).keys()]
if not expires in expire_options:
return HttpResponseBadRequest('Invalid expire choice "{}" given. '
'Valid values are: {}'.format(expires, ', '.join(expire_options)))
if expires not in expire_options:
return HttpResponseBadRequest(
'Invalid expire choice "{}" given. Valid values are: {}'.format(
expires, ', '.join(expire_options)))
expires, expire_type = get_expire_values(expires)
else:
expires = datetime.datetime.now() + datetime.timedelta(seconds=60 * 60 * 24)