Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Websites UFRPE
Django Private Storage
Commits
4bcf2182
Commit
4bcf2182
authored
Jan 31, 2018
by
Diederik van der Boor
Browse files
Remove Django 1.6 / 1.7 compatibility code
parent
d7ec3ddd
Changes
4
Hide whitespace changes
Inline
Side-by-side
makemessages.py
View file @
4bcf2182
#!/usr/bin/env python
import
os
import
django
from
os
import
path
from
django.conf
import
settings
from
django.core.management
import
call_command
...
...
@@ -16,9 +15,7 @@ def main():
),
)
if
django
.
VERSION
>=
(
1
,
7
):
django
.
setup
()
django
.
setup
()
makemessages
()
def
makemessages
():
...
...
private_storage/fields.py
View file @
4bcf2182
...
...
@@ -4,7 +4,6 @@ from __future__ import unicode_literals
import
logging
import
os
import
django
from
django.core.exceptions
import
ValidationError
from
django.core.files.uploadedfile
import
UploadedFile
from
django.db
import
models
...
...
@@ -36,8 +35,6 @@ class PrivateFileField(models.FileField):
self
.
max_file_size
=
kwargs
.
pop
(
"max_file_size"
,
None
)
kwargs
.
setdefault
(
'storage'
,
private_storage
)
if
self
.
_upload
and
django
.
VERSION
<
(
1
,
7
):
kwargs
.
setdefault
(
'upload_to'
,
'uploads'
)
# shut up warnings from Django 1.6- model validation
super
(
PrivateFileField
,
self
).
__init__
(
*
args
,
**
kwargs
)
def
clean
(
self
,
*
args
,
**
kwargs
):
...
...
runtests.py
View file @
4bcf2182
#!/usr/bin/env python
import
sys
import
django
from
django.conf
import
settings
,
global_settings
as
default_settings
from
django.core.management
import
execute_from_command_line
from
os
import
path
...
...
@@ -10,42 +9,6 @@ if not settings.configured:
sys
.
path
.
insert
(
0
,
path
.
join
(
module_root
,
'example'
))
if
django
.
VERSION
>=
(
1
,
8
):
template_settings
=
dict
(
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
(),
'DEBUG'
:
True
,
'OPTIONS'
:
{
'loaders'
:
(
'django.template.loaders.filesystem.Loader'
,
'django.template.loaders.app_directories.Loader'
,
),
'context_processors'
:
(
'django.template.context_processors.debug'
,
'django.template.context_processors.i18n'
,
'django.template.context_processors.media'
,
'django.template.context_processors.request'
,
'django.template.context_processors.static'
,
'django.contrib.auth.context_processors.auth'
,
),
},
},
]
)
else
:
template_settings
=
dict
(
TEMPLATE_LOADERS
=
(
'django.template.loaders.app_directories.Loader'
,
'django.template.loaders.filesystem.Loader'
,
),
TEMPLATE_CONTEXT_PROCESSORS
=
list
(
default_settings
.
TEMPLATE_CONTEXT_PROCESSORS
)
+
[
'django.core.context_processors.request'
,
],
TEMPLATE_DEBUG
=
True
,
)
settings
.
configure
(
DEBUG
=
False
,
# will be False anyway by DjangoTestRunner.
DATABASES
=
{
...
...
@@ -58,8 +21,27 @@ if not settings.configured:
'private_storage'
,
),
TEST_RUNNER
=
'django.test.runner.DiscoverRunner'
,
TEMPLATES
=
[
{
'BACKEND'
:
'django.template.backends.django.DjangoTemplates'
,
'DIRS'
:
(),
'OPTIONS'
:
{
'loaders'
:
(
'django.template.loaders.filesystem.Loader'
,
'django.template.loaders.app_directories.Loader'
,
),
'context_processors'
:
(
'django.template.context_processors.debug'
,
'django.template.context_processors.i18n'
,
'django.template.context_processors.media'
,
'django.template.context_processors.request'
,
'django.template.context_processors.static'
,
'django.contrib.auth.context_processors.auth'
,
),
},
},
],
AWS_PRIVATE_STORAGE_BUCKET_NAME
=
'foobar'
,
**
template_settings
)
...
...
setup.py
View file @
4bcf2182
...
...
@@ -71,12 +71,11 @@ setup(
'Programming Language :: Python :: 3.5'
,
'Programming Language :: Python :: 3.6'
,
'Framework :: Django'
,
'Framework :: Django :: 1.6'
,
'Framework :: Django :: 1.7'
,
'Framework :: Django :: 1.8'
,
'Framework :: Django :: 1.9'
,
'Framework :: Django :: 1.10'
,
'Framework :: Django :: 1.11'
,
'Framework :: Django :: 2.0'
,
'Topic :: Internet :: WWW/HTTP'
,
'Topic :: Internet :: WWW/HTTP :: Dynamic Content'
,
'Topic :: Software Development :: Libraries :: Application Frameworks'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment