Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hub
ViralHostRangeDB
Commits
ad03a318
Commit
ad03a318
authored
Sep 30, 2019
by
Bryan BRANCOTTE
Browse files
Revert "Attempt to solve encoding issue on filename of
#102
"
This reverts commit
a4f043ae
parent
3fc8a6b5
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/viralhostrange/viralhostrangedb/views.py
View file @
ad03a318
...
...
@@ -2,7 +2,6 @@ import itertools
import
json
import
os
import
tempfile
import
unicodedata
import
pandas
as
pd
from
basetheme_bootstrap.user_preferences
import
get_user_preferences_for_user
...
...
@@ -843,17 +842,6 @@ def data_source_download(request, pk):
return
response
# http://source.mihelac.org/2011/02/6/rename-uploaded-files-ascii-character-set-django/
class
ASCIIFileSystemStorage
(
storage
.
FileSystemStorage
):
"""
Convert unicode characters in name to ASCII characters.
"""
def
get_valid_name
(
self
,
name
):
name
=
unicodedata
.
normalize
(
'NFKD'
,
name
).
encode
(
'ascii'
,
'ignore'
)
return
super
(
ASCIIFileSystemStorage
,
self
).
get_valid_name
(
name
)
@
method_decorator
(
login_required
,
name
=
'dispatch'
)
class
DataSourceWizard
(
wizard_views
.
NamedUrlSessionWizardView
):
def
get_upload_or_live_input
(
self
):
...
...
@@ -886,7 +874,7 @@ class DataSourceWizard(wizard_views.NamedUrlSessionWizardView):
"Upload"
:
upload_data
,
}
template_name
=
'viralhostrangedb/wizard_form.html'
file_storage
=
ASCII
FileSystemStorage
(
location
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
'viralhostrangedb_wizard'
))
file_storage
=
storage
.
FileSystemStorage
(
location
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
'viralhostrangedb_wizard'
))
def
get_context_data
(
self
,
form
,
step
=
None
,
**
kwargs
):
context
=
super
().
get_context_data
(
form
=
form
,
step
=
step
,
**
kwargs
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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