Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
805279fb
Commit
805279fb
authored
Feb 03, 2014
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #462 from smurfix/upstream
_get_dir_url() may be called without a path
parents
20ee4cd2
231334c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
fileadmin.py
flask_admin/contrib/fileadmin.py
+8
-8
No files found.
flask_admin/contrib/fileadmin.py
View file @
805279fb
...
...
@@ -285,7 +285,7 @@ class FileAdmin(BaseView, ActionsMixin):
"""
file_data
.
save
(
path
)
def
_get_dir_url
(
self
,
endpoint
,
path
,
**
kwargs
):
def
_get_dir_url
(
self
,
endpoint
,
path
=
None
,
**
kwargs
):
"""
Return prettified URL
...
...
@@ -423,7 +423,7 @@ class FileAdmin(BaseView, ActionsMixin):
base_path
,
directory
,
path
=
self
.
_normalize_path
(
path
)
if
not
self
.
is_accessible_path
(
path
):
flash
(
gettext
(
gettext
(
'Permission denied.'
)
))
flash
(
gettext
(
'Permission denied.'
))
return
redirect
(
self
.
_get_dir_url
(
'.index'
))
# Get directory listing
...
...
@@ -486,7 +486,7 @@ class FileAdmin(BaseView, ActionsMixin):
return
redirect
(
self
.
_get_dir_url
(
'.index'
,
path
))
if
not
self
.
is_accessible_path
(
path
):
flash
(
gettext
(
gettext
(
'Permission denied.'
)
))
flash
(
gettext
(
'Permission denied.'
))
return
redirect
(
self
.
_get_dir_url
(
'.index'
))
form
=
UploadForm
(
self
)
...
...
@@ -547,7 +547,7 @@ class FileAdmin(BaseView, ActionsMixin):
return
redirect
(
dir_url
)
if
not
self
.
is_accessible_path
(
path
):
flash
(
gettext
(
gettext
(
'Permission denied.'
)
))
flash
(
gettext
(
'Permission denied.'
))
return
redirect
(
self
.
_get_dir_url
(
'.index'
))
form
=
NameForm
(
helpers
.
get_form_data
())
...
...
@@ -558,7 +558,7 @@ class FileAdmin(BaseView, ActionsMixin):
self
.
on_mkdir
(
directory
,
form
.
name
.
data
)
return
redirect
(
dir_url
)
except
Exception
as
ex
:
flash
(
gettext
(
'Failed to create directory:
%(error)
s'
,
ex
),
'error'
)
flash
(
gettext
(
'Failed to create directory:
%(error)
s'
,
e
rror
=
e
x
),
'error'
)
return
self
.
render
(
self
.
mkdir_template
,
form
=
form
,
...
...
@@ -584,7 +584,7 @@ class FileAdmin(BaseView, ActionsMixin):
return
redirect
(
return_url
)
if
not
self
.
is_accessible_path
(
path
):
flash
(
gettext
(
gettext
(
'Permission denied.'
)
))
flash
(
gettext
(
'Permission denied.'
))
return
redirect
(
self
.
_get_dir_url
(
'.index'
))
if
op
.
isdir
(
full_path
):
...
...
@@ -627,7 +627,7 @@ class FileAdmin(BaseView, ActionsMixin):
return
redirect
(
return_url
)
if
not
self
.
is_accessible_path
(
path
):
flash
(
gettext
(
gettext
(
'Permission denied.'
)
))
flash
(
gettext
(
'Permission denied.'
))
return
redirect
(
self
.
_get_dir_url
(
'.index'
))
if
not
op
.
exists
(
full_path
):
...
...
@@ -673,7 +673,7 @@ class FileAdmin(BaseView, ActionsMixin):
base_path
,
full_path
,
path
=
self
.
_normalize_path
(
path
)
if
not
self
.
is_accessible_path
(
path
)
or
not
self
.
is_file_editable
(
path
):
flash
(
gettext
(
gettext
(
'Permission denied.'
)
))
flash
(
gettext
(
'Permission denied.'
))
return
redirect
(
self
.
_get_dir_url
(
'.index'
))
dir_url
=
self
.
_get_dir_url
(
'.index'
,
os
.
path
.
dirname
(
path
))
...
...
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