Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
ff2f2e64
Commit
ff2f2e64
authored
Apr 24, 2001
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regex free
parent
2e77beba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
lib/python/webdav/client.py
lib/python/webdav/client.py
+9
-7
No files found.
lib/python/webdav/client.py
View file @
ff2f2e64
"""HTTP 1.1 / WebDAV client library."""
"""HTTP 1.1 / WebDAV client library."""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
regex
,
time
,
types
import
sys
,
os
,
string
,
time
,
types
,
re
import
socket
,
httplib
,
mimetools
import
socket
,
httplib
,
mimetools
from
types
import
FileType
from
types
import
FileType
from
mimetypes
import
guess_type
from
mimetypes
import
guess_type
...
@@ -57,8 +57,9 @@ class Resource:
...
@@ -57,8 +57,9 @@ class Resource:
self
.
username
=
username
self
.
username
=
username
self
.
password
=
password
self
.
password
=
password
self
.
url
=
url
self
.
url
=
url
if
urlregex
.
match
(
url
)
>=
0
:
mo
=
urlregex
(
match
(
url
))
host
,
port
,
uri
=
urlregex
.
group
(
1
,
2
,
3
)
if
mo
:
host
,
port
,
uri
=
mo
.
group
(
1
,
2
,
3
)
self
.
host
=
host
self
.
host
=
host
self
.
port
=
port
and
string
.
atoi
(
port
[
1
:])
or
80
self
.
port
=
port
and
string
.
atoi
(
port
[
1
:])
or
80
self
.
uri
=
uri
or
'/'
self
.
uri
=
uri
or
'/'
...
@@ -156,11 +157,11 @@ class Resource:
...
@@ -156,11 +157,11 @@ class Resource:
return
self
.
__snd_request
(
'POST'
,
self
.
uri
,
headers
,
body
)
return
self
.
__snd_request
(
'POST'
,
self
.
uri
,
headers
,
body
)
def
put
(
self
,
file
=
''
,
content_type
=
''
,
content_enc
=
''
,
def
put
(
self
,
file
=
''
,
content_type
=
''
,
content_enc
=
''
,
isbin
=
re
gex
.
compile
(
'[
\
0
-
\
6
\
177
-
\
277
]'
).
search
,
isbin
=
re
.
compile
(
'[
\
0
-
\
6
\
177
-
\
277
]'
).
search
,
**
kw
):
**
kw
):
headers
=
self
.
__get_headers
(
kw
)
headers
=
self
.
__get_headers
(
kw
)
filetype
=
type
(
file
)
filetype
=
type
(
file
)
if
filetype
is
type
(
''
)
and
(
isbin
(
file
)
<
0
)
and
\
if
filetype
is
type
(
''
)
and
(
isbin
(
file
)
is
None
)
and
\
os
.
path
.
exists
(
file
):
os
.
path
.
exists
(
file
):
ob
=
open
(
file
,
'rb'
)
ob
=
open
(
file
,
'rb'
)
body
=
ob
.
read
()
body
=
ob
.
read
()
...
@@ -423,7 +424,8 @@ find_xml="""<?xml version="1.0" encoding="utf-8" ?>
...
@@ -423,7 +424,8 @@ find_xml="""<?xml version="1.0" encoding="utf-8" ?>
##############################################################################
##############################################################################
# Implementation details below here
# Implementation details below here
urlregex
=
regex
.
compile
(
'http://
\
([^:/]+
\
)
\
(:[
0
-9]+
\
)?
\
(/.+
\
)?
'
, regex.casefold)
urlregex
=
re
.
compile
(
'http://([^:/]+)(:[0-9]+)?(/.+)?'
,
re
.
I
)
def
marshal_string
(
name
,
val
):
def
marshal_string
(
name
,
val
):
return
'%s=%s'
%
(
name
,
quote
(
str
(
val
)))
return
'%s=%s'
%
(
name
,
quote
(
str
(
val
)))
...
...
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