Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flaskdav
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
flaskdav
Commits
1a08344c
Commit
1a08344c
authored
Jan 18, 2016
by
iv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WebDAV works on WebDAV root.
parent
7d175c02
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
flaskdav.py
flaskdav.py
+10
-3
utils.py
utils.py
+1
-1
No files found.
flaskdav.py
View file @
1a08344c
...
@@ -133,6 +133,7 @@ def before_request():
...
@@ -133,6 +133,7 @@ def before_request():
return
response
return
response
g
.
status
=
status_code
g
.
status
=
status_code
debug
(
'headers: '
+
str
(
headers
))
g
.
headers
=
headers
g
.
headers
=
headers
class
WebDAV
(
MethodView
):
class
WebDAV
(
MethodView
):
...
@@ -168,6 +169,7 @@ class WebDAV(MethodView):
...
@@ -168,6 +169,7 @@ class WebDAV(MethodView):
"""
"""
status
=
g
.
status
status
=
g
.
status
headers
=
g
.
headers
headers
=
g
.
headers
debug
(
'pathname: '
+
pathname
)
localpath
=
app
.
fs_handler
.
uri2local
(
URI_BEGINNING_PATH
[
'webdav'
]
+
pathname
)
localpath
=
app
.
fs_handler
.
uri2local
(
URI_BEGINNING_PATH
[
'webdav'
]
+
pathname
)
data
=
''
data
=
''
...
@@ -235,8 +237,9 @@ class WebDAV(MethodView):
...
@@ -235,8 +237,9 @@ class WebDAV(MethodView):
self
.
get_body
())
self
.
get_body
())
try
:
try
:
response
=
make_response
(
pf
.
create_response
()
+
'
\
n
'
,
status
,
headers
)
response
=
make_response
(
pf
.
create_response
()
+
'
\
n
'
,
status
,
headers
)
except
IOError
:
except
IOError
,
e
:
response
=
make_response
(
''
,
404
,
headers
)
debug
(
e
)
response
=
make_response
(
'Not found'
,
404
,
headers
)
return
response
return
response
...
@@ -358,9 +361,13 @@ class WebDAV(MethodView):
...
@@ -358,9 +361,13 @@ class WebDAV(MethodView):
return
make_response
(
''
,
g
.
status
,
g
.
headers
)
return
make_response
(
''
,
g
.
status
,
g
.
headers
)
webdav_view
=
WebDAV
.
as_view
(
'dav'
)
app
.
add_url_rule
(
'/webdav/'
,
defaults
=
{
'pathname'
:
''
},
view_func
=
webdav_view
)
app
.
add_url_rule
(
URI_BEGINNING_PATH
[
'webdav'
]
+
'<path:pathname>'
,
app
.
add_url_rule
(
URI_BEGINNING_PATH
[
'webdav'
]
+
'<path:pathname>'
,
view_func
=
WebDAV
.
as_view
(
'dav'
)
)
view_func
=
webdav_view
)
@
app
.
route
(
URI_BEGINNING_PATH
[
'authorization'
],
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
URI_BEGINNING_PATH
[
'authorization'
],
methods
=
[
'GET'
,
'POST'
])
...
...
utils.py
View file @
1a08344c
...
@@ -77,7 +77,7 @@ class FilesystemHandler():
...
@@ -77,7 +77,7 @@ class FilesystemHandler():
def
uri2local
(
self
,
uri
):
def
uri2local
(
self
,
uri
):
""" map uri in baseuri and local part """
""" map uri in baseuri and local part """
path
=
os
.
path
.
normpath
(
uri
)
path
=
os
.
path
.
normpath
(
uri
)
+
'/'
if
path
.
startswith
(
self
.
baseuri
):
if
path
.
startswith
(
self
.
baseuri
):
path
=
path
[
len
(
self
.
baseuri
):]
path
=
path
[
len
(
self
.
baseuri
):]
filepath
=
os
.
path
.
join
(
self
.
directory
,
path
)
filepath
=
os
.
path
.
join
(
self
.
directory
,
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