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
f0176505
Unverified
Commit
f0176505
authored
Jan 14, 2020
by
Diederik van der Boor
Browse files
Resolve Django 3.0 compatibility with new import locations
parent
785946dd
Changes
2
Hide whitespace changes
Inline
Side-by-side
private_storage/fields.py
View file @
f0176505
...
...
@@ -6,6 +6,7 @@ import logging
import
os
import
posixpath
import
warnings
import
sys
import
django
from
django.core.exceptions
import
ValidationError
...
...
@@ -13,14 +14,20 @@ from django.core.files.uploadedfile import UploadedFile
from
django.db
import
models
from
django.template.defaultfilters
import
filesizeformat
from
django.utils.encoding
import
force_str
,
force_text
from
django.utils.six
import
string_types
from
django.utils.translation
import
ugettext_lazy
as
_
from
.storage
import
private_storage
logger
=
logging
.
getLogger
(
__name__
)
try
:
string_types
=
basestring
,
# Python 2
except
NameError
:
string_types
=
str
,
# Python 3
class
PrivateFileField
(
models
.
FileField
):
"""
Filefield with private storage, custom filename and size checks.
...
...
private_storage/servers.py
View file @
f0176505
...
...
@@ -10,16 +10,17 @@ from django.conf import settings
from
django.core.exceptions
import
ImproperlyConfigured
from
django.http
import
FileResponse
,
HttpResponse
,
HttpResponseNotModified
from
django.utils.http
import
http_date
from
django.utils.lru_cache
import
lru_cache
from
django.utils.module_loading
import
import_string
from
django.views.static
import
serve
,
was_modified_since
try
:
# python 3
from
urllib.parse
import
quote
from
functools
import
lru_cache
# Python 3
except
ImportError
:
# python 2
from
urllib
import
quote
from
django.utils.lru_cache
import
lru_cache
# Django <3
@
lru_cache
()
...
...
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