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
ac181a2d
Commit
ac181a2d
authored
Jul 15, 1999
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Checked in Scott Robertson's thread-safety fixes.
parent
cbe5af3e
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
157 additions
and
125 deletions
+157
-125
lib/python/AccessControl/User.py
lib/python/AccessControl/User.py
+3
-3
lib/python/App/Product.py
lib/python/App/Product.py
+1
-1
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+3
-3
lib/python/Shared/DC/ZRDB/Aqueduct.py
lib/python/Shared/DC/ZRDB/Aqueduct.py
+59
-42
lib/python/StructuredText/StructuredText.py
lib/python/StructuredText/StructuredText.py
+79
-61
lib/python/ZPublisher/Client.py
lib/python/ZPublisher/Client.py
+7
-9
lib/python/webdav/client.py
lib/python/webdav/client.py
+5
-6
No files found.
lib/python/AccessControl/User.py
View file @
ac181a2d
...
...
@@ -84,7 +84,7 @@
##############################################################################
"""Access control package"""
__version__
=
'$Revision: 1.8
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.8
5
$'
[
11
:
-
2
]
import
Globals
,
App
.
Undo
,
socket
,
regex
from
Globals
import
HTMLFile
,
MessageDialog
,
Persistent
,
PersistentMapping
...
...
@@ -715,8 +715,8 @@ def rolejoin(roles, other):
roles
.
sort
()
return
roles
addr_match
=
regex
.
compile
(
'[0-9
\
.
\
*]*'
).
match
host_match
=
regex
.
compile
(
'[A-Za-z0-9
\
.
\
*]*'
).
match
addr_match
=
regex
.
compile
(
'[0-9
\
.
\
*]*'
).
match
#TS
host_match
=
regex
.
compile
(
'[A-Za-z0-9
\
.
\
*]*'
).
match
#TS
def
domainSpecMatch
(
spec
,
request
):
...
...
lib/python/App/Product.py
View file @
ac181a2d
...
...
@@ -155,7 +155,7 @@ class Product(Folder):
import_error_
=
None
def
new_version
(
self
,
_intending
=
regex
.
compile
(
"[.]?[0-9]+$"
).
search
,
_intending
=
regex
.
compile
(
"[.]?[0-9]+$"
).
search
,
#TS
):
# Return a new version number based on the existing version.
v
=
str
(
self
.
version
)
...
...
lib/python/OFS/ObjectManager.py
View file @
ac181a2d
...
...
@@ -84,9 +84,9 @@
##############################################################################
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.7
6 1999/07/08 11:28:50
jim Exp $"""
$Id: ObjectManager.py,v 1.7
7 1999/07/15 16:49:02
jim Exp $"""
__version__
=
'$Revision: 1.7
6
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.7
7
$'
[
11
:
-
2
]
import
App.Management
,
Acquisition
,
App
.
Undo
,
Globals
,
CopySupport
import
os
,
App
.
FactoryDispatcher
,
ts_regex
,
Products
...
...
@@ -98,7 +98,7 @@ from urllib import quote
from
cStringIO
import
StringIO
import
marshal
bad_id
=
ts_regex
.
compile
(
'[^a-zA-Z0-9-_~
\
,
\
. ]'
).
match
bad_id
=
ts_regex
.
compile
(
'[^a-zA-Z0-9-_~
\
,
\
. ]'
).
match
#TS
_marker
=
[]
class
ObjectManager
(
...
...
lib/python/Shared/DC/ZRDB/Aqueduct.py
View file @
ac181a2d
...
...
@@ -84,12 +84,12 @@
##############################################################################
__doc__
=
'''Shared classes and functions
$Id: Aqueduct.py,v 1.3
2 1999/03/22 23:20:16
jim Exp $'''
__version__
=
'$Revision: 1.3
2
$'
[
11
:
-
2
]
$Id: Aqueduct.py,v 1.3
3 1999/07/15 16:38:22
jim Exp $'''
__version__
=
'$Revision: 1.3
3
$'
[
11
:
-
2
]
import
Globals
,
os
from
Globals
import
HTMLFile
,
Persistent
import
DocumentTemplate
,
DateTime
,
regex
,
regsub
,
string
import
DocumentTemplate
,
DateTime
,
ts_regex
,
regex
,
string
import
binascii
,
Acquisition
DateTime
.
now
=
DateTime
.
DateTime
from
cStringIO
import
StringIO
...
...
@@ -97,7 +97,7 @@ from OFS import SimpleItem
from
AccessControl.Role
import
RoleManager
from
DocumentTemplate
import
HTML
from
string
import
strip
from
string
import
strip
,
replace
dtml_dir
=
Globals
.
package_home
(
globals
())
...
...
@@ -337,11 +337,11 @@ class Args:
def
parse
(
text
,
result
=
None
,
keys
=
None
,
unparmre
=
regex
.
compile
(
unparmre
=
ts_
regex
.
compile
(
'
\
([
\
0- ]*
\
([^
\
0- =
\
"
]+
\
)
\
)'
),
parmre
=
regex
.
compile
(
parmre
=
ts_
regex
.
compile
(
'
\
([
\
0- ]*
\
([^
\
0- =
\
"
]+
\
)=
\
([^
\
0
- =
\
"
]+
\
)
\
)'
),
qparmre
=
regex
.
compile
(
qparmre
=
ts_
regex
.
compile
(
'
\
([
\
0- ]*
\
([^
\
0- =
\
"
]+
\
)=
"
\
([^
"
]*
\
)
\
"
\
)
'
),
):
...
...
@@ -351,21 +351,30 @@ def parse(text,
__traceback_info__=text
if parmre.match(text) >= 0:
name=parmre.group(2)
value={'
default
':parmre.group(3)}
l=len(parmre.group(1))
elif qparmre.match(text) >= 0:
name=qparmre.group(2)
value={'
default
':qparmre.group(3)}
l=len(qparmre.group(1))
elif unparmre.match(text) >= 0:
name=unparmre.group(2)
l=len(unparmre.group(1))
value={}
ts_results = parmre.match_group(text, (1,2,3))
if ts_results:
start, grps = ts_results
name=grps[1]
value={'
default
':grps[2]}
l=len(grps[0])
else:
if not text or not strip(text): return Args(result,keys)
raise InvalidParameter, text
ts_results = qparmre.match_group(text, (1,2,3))
if ts_results:
start, grps = ts_results
name=grps[1]
value={'
default
':grps[2]}
l=len(grps[0])
else:
ts_results = unparmre.match_group(text, (1,2))
if ts_reults:
start, grps = ts_results
name=grps[1]
l=len(grps[0])
value={}
else:
if not text or not strip(text): return Args(result,keys)
raise InvalidParameter, text
lt=string.find(name,'
:
')
if lt > 0:
...
...
@@ -379,33 +388,38 @@ def parse(text,
def quotedHTML(text,
character_entities=(
(regex.compile('
&
'), '
&
amp
;
'),
(regex.compile("<"), '
&
lt
;
' ),
(regex.compile(">"), '
&
gt
;
' ),
(regex.compile('"'), '"'))): #"
import
regsub
('
&
', '
&
amp
;
'),
("<", '
&
lt
;
' ),
(">", '
&
gt
;
' ),
('"', '"'))): #"
for
re
,
name
in
character_entities
:
text
=
regsub
.
gsub
(
re
,
name
,
text
)
text
=
replace
(
text
,
re
,
name
)
return
text
def
nicify
(
name
,
under
=
regex
.
compile
(
'_'
)
):
name
=
re
gsub
.
gsub
(
under
,
' '
,
string
.
strip
(
name
)
)
def
nicify
(
name
):
name
=
re
place
(
string
.
strip
(
name
),
'_'
,
' '
)
return
string
.
upper
(
name
[:
1
])
+
name
[
1
:]
def
decapitate
(
html
,
RESPONSE
=
None
,
header_re
=
regex
.
compile
(
header_re
=
ts_
regex
.
compile
(
'
\
(
\
('
'[^
\
0
- <>:]+:[^
\
n
]*
\
n
'
'
\
|
'
'
[
\
t
]
+
[
^
\
0
-
][
^
\
n
]
*
\
n
'
'
\
)
+
\
)[
\
t
]
*
\
n
\
([
\
0
-
\
377
]
+
\
)
'
),
space_re=regex.compile('
\
([
\
t
]
+
\
)
'),
name_re=regex.compile('
\
([
^
\
0
-
<>
:]
+
\
):
\
([
^
\
n
]
*
\
)
'),
space_re=
ts_
regex.compile('
\
([
\
t
]
+
\
)
'),
name_re=
ts_
regex.compile('
\
([
^
\
0
-
<>
:]
+
\
):
\
([
^
\
n
]
*
\
)
'),
):
if header_re.match(html) < 0: return html
headers, html = header_re.group(1,3)
ts_results = header_re.match_group(html, (1,3))
if not ts_results: return html
headers, html = ts_reulsts[1]
headers=string.split(headers,'
\
n
')
...
...
@@ -413,16 +427,19 @@ def decapitate(html, RESPONSE=None,
while i < len(headers):
if not headers[i]:
del headers[i]
elif space_re.match(headers[i]) >= 0:
headers[i-1]="%s %s" % (headers[i-1],
headers[i][len(space_re.group(1)):])
del headers[i]
else:
i=i+1
else:
ts_results = space_re.match_group(headers[i], (1,))
if ts_reults:
headers[i-1]="%s %s" % (headers[i-1],
headers[i][len(ts_reults[1]):])
del headers[i]
else:
i=i+1
for i in range(len(headers)):
if name_re.match(headers[i]) >= 0:
k, v = name_re.group(1,2)
ts_results = name_re.match_group(headers[i], (1,2))
if ts_reults:
k, v = ts_reults[1]
v=string.strip(v)
else:
raise ValueError, '
Invalid
Header
(
%
d
):
%
s
' % (i,headers[i])
...
...
lib/python/StructuredText/StructuredText.py
View file @
ac181a2d
...
...
@@ -170,7 +170,7 @@ Special symbology is used to indicate special constructs:
Together with the previous rule this allows easy coding of references or
end notes.
$Id: StructuredText.py,v 1.1
8 1999/03/24 00:03:18 kl
m Exp $'''
$Id: StructuredText.py,v 1.1
9 1999/07/15 16:43:15 ji
m Exp $'''
# Copyright
#
# Copyright 1996 Digital Creations, L.C., 910 Princess Anne
...
...
@@ -222,6 +222,9 @@ $Id: StructuredText.py,v 1.18 1999/03/24 00:03:18 klm Exp $'''
# (540) 371-6909
#
# $Log: StructuredText.py,v $
# Revision 1.19 1999/07/15 16:43:15 jim
# Checked in Scott Robertson's thread-safety fixes.
#
# Revision 1.18 1999/03/24 00:03:18 klm
# Provide for relative links, eg <a href="file_in_same_dir">whatever</a>,
# as:
...
...
@@ -327,14 +330,13 @@ $Id: StructuredText.py,v 1.18 1999/03/24 00:03:18 klm Exp $'''
#
#
#
import
regex
,
regsub
from
regsub
import
gsub
import
ts_regex
from
ts_regex
import
gsub
from
string
import
split
,
join
,
strip
,
find
indent_tab
=
regex
.
compile
(
'
\
(
\
n
\
|^
\
)
\
( *
\
)
\
t
'
)
indent_space
=
regex
.
compile
(
'
\
n
\
( *
\
)'
)
paragraph_divider
=
regex
.
compile
(
'
\
(
\
n *
\
)+
\
n'
)
indent_tab
=
ts_
regex
.
compile
(
'
\
(
\
n
\
|^
\
)
\
( *
\
)
\
t
'
)
indent_space
=
ts_
regex
.
compile
(
'
\
n
\
( *
\
)'
)
paragraph_divider
=
ts_
regex
.
compile
(
'
\
(
\
n *
\
)+
\
n'
)
def
untabify
(
aString
):
'''
\
...
...
@@ -343,10 +345,11 @@ def untabify(aString):
result
=
''
rest
=
aString
while
1
:
start
=
indent_tab
.
search
(
rest
)
if
start
>=
0
:
lnl
=
len
(
indent_tab
.
group
(
1
))
indent
=
len
(
indent_tab
.
group
(
2
))
ts_results
=
indent_tab
.
search_group
(
rest
,
(
1
,
2
))
if
ts_results
:
start
,
grps
=
ts_results
lnl
=
len
(
grps
[
0
])
indent
=
len
(
grps
[
1
])
result
=
result
+
rest
[:
start
]
rest
=
"
\
n
%s%s"
%
(
' '
*
((
indent
/
8
+
1
)
*
8
),
rest
[
start
+
indent
+
1
+
lnl
:])
...
...
@@ -390,9 +393,11 @@ def indent_level(aString):
text
=
'
\
n
'
+
aString
indent
=
l
=
len
(
text
)
while
1
:
start
=
indent_space
.
search
(
text
,
start
)
if
start
>=
0
:
i
=
len
(
indent_space
.
group
(
1
))
ts_results
=
indent_space
.
search_group
(
text
,
(
1
,
2
),
start
)
if
ts_results
:
start
,
grps
=
ts_results
i
=
len
(
grps
[
0
])
start
=
start
+
i
+
1
if
start
<
l
and
text
[
start
]
!=
'
\
n
'
:
# Skip blank lines
if
not
i
:
return
(
0
,
aString
)
...
...
@@ -419,12 +424,12 @@ def structure(list):
i
=
i
+
sublen
return
r
bullet
=
regex
.
compile
(
'[
\
t
\
n
]*[o*-][
\
t
\
n
]+
\
([^
\
0]*
\
)
'
)
example=
regex.compile('
[
\
0
-
]
examples
?
:[
\
0
-
]
*
$
')
dl=regex.compile('
\
([
^
\
n
]
+
\
)[
\
t
]
+--
[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
)
')
nl=
regex.compile('
\
n
')
ol=regex.compile('
[
\
t
]
*
\
(
\
([
0
-
9
]
+
\
|
[
a
-
zA
-
Z
]
+
\
)[.)]
\
)
+
[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
|
$
\
)
')
olp=regex.compile('
[
\
t
]
*
([
0
-
9
]
+
)[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
|
$
\
)
')
bullet
=
ts_
regex
.
compile
(
'[
\
t
\
n
]*[o*-][
\
t
\
n
]+
\
([^
\
0]*
\
)
'
)
example=
ts_regex.compile('
[
\
0
-
]
examples
?
:[
\
0
-
]
*
$
').search
dl=
ts_
regex.compile('
\
([
^
\
n
]
+
\
)[
\
t
]
+--
[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
)
')
nl=
ts_regex.compile('
\
n
').search
ol=
ts_
regex.compile('
[
\
t
]
*
\
(
\
([
0
-
9
]
+
\
|
[
a
-
zA
-
Z
]
+
\
)[.)]
\
)
+
[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
|
$
\
)
')
olp=
ts_
regex.compile('
[
\
t
]
*
([
0
-
9
]
+
)[
\
t
\
n
]
+
\
([
^
\
0
]
*
\
|
$
\
)
')
optional_trailing_punctuation = '
\
(,
\
|
\
([.:
?
;]
\
)
\
)
?
'
...
...
@@ -474,7 +479,7 @@ class StructuredText:
aStructuredString)
self.level=level
paragraphs=
regsub
.split(untabify(aStructuredString),paragraph_divider)
paragraphs=
ts_regex
.split(untabify(aStructuredString),paragraph_divider)
paragraphs=map(indent_level,paragraphs)
self.structure=structure(paragraphs)
...
...
@@ -488,10 +493,10 @@ ctag_prefix="\([\0- (]\|^\)"
ctag_suffix="
\
([
\
0- ,.:;!?)]
\
|$
\
)"
ctag_middle="[%s]
\
([^
\
0- %s][^%s]*[^
\
0
- %s]
\
|[^%s]
\
)[%s]"
ctag_middl2="[%s][%s]
\
([^
\
0- %s][^%s]*[^
\
0
- %s]
\
|[^%s]
\
)[%s][%s]"
em =regex.compile(ctag_prefix+(ctag_middle % (("*",)*6) )+ctag_suffix)
strong=regex.compile(ctag_prefix+(ctag_middl2 % (("*",)*8))+ctag_suffix)
under =regex.compile(ctag_prefix+(ctag_middle % (("_",)*6) )+ctag_suffix)
code =regex.compile(ctag_prefix+(ctag_middle % (("
\
'
",)*6))+ctag_suffix)
em =
ts_
regex.compile(ctag_prefix+(ctag_middle % (("*",)*6) )+ctag_suffix)
strong=
ts_
regex.compile(ctag_prefix+(ctag_middl2 % (("*",)*8))+ctag_suffix)
under =
ts_
regex.compile(ctag_prefix+(ctag_middle % (("_",)*6) )+ctag_suffix)
code =
ts_
regex.compile(ctag_prefix+(ctag_middle % (("
\
'
",)*6))+ctag_suffix)
def ctag(s):
if s is None: s=''
...
...
@@ -508,9 +513,9 @@ class HTML(StructuredText):
'''
\
def __str__(self,
extra_dl=regex.compile("</dl>
\
n
<dl>"),
extra_ul=regex.compile("</ul>
\
n
<ul>"),
extra_ol=regex.compile("</ol>
\
n
<ol>"),
extra_dl=
ts_
regex.compile("</dl>
\
n
<dl>"),
extra_ul=
ts_
regex.compile("</ul>
\
n
<ul>"),
extra_ol=
ts_
regex.compile("</ol>
\
n
<ol>"),
):
'''
\
Return an HTML string representation of the structured text data.
...
...
@@ -563,40 +568,52 @@ class HTML(StructuredText):
r=''
for s in structure:
# print s[0],'
\
n
', len(s[1]), '
\
n
\
n
'
if bullet.match(s[0]) >= 0:
p=bullet.group(1)
ts_results = bullet.match_group(s[0], (1,))
if ts_results:
p = ts_results[1]
r=self.ul(r,p,self._str(s[1],level))
elif ol.match(s[0]) >= 0:
p=ol.group(3)
r=self.ol(r,p,self._str(s[1],level))
elif olp.match(s[0]) >= 0:
p=olp.group(1)
r=self.ol(r,p,self._str(s[1],level))
elif dl.match(s[0]) >= 0:
t,d=dl.group(1,2)
r=self.dl(r,t,d,self._str(s[1],level))
elif example.search(s[0]) >= 0 and s[1]:
# Introduce an example, using pre tags:
r=self.normal(r,s[0],self.pre(s[1]))
elif s[0][-2:]=='
::
' and s[1]:
# Introduce an example, using pre tags:
r=self.normal(r,s[0][:-1],self.pre(s[1]))
elif nl.search(s[0]) < 0 and s[1] and s[0][-1:] != '
:
':
# Treat as a heading
t=s[0]
r=self.head(r,t,level,
self._str(s[1],level and level+1))
else:
r=self.normal(r,s[0],self._str(s[1],level))
else:
ts_results = ol.match_group(s[0], (3,))
if ts_results:
p = ts_results[1]
r=self.ol(r,p,self._str(s[1],level))
else:
ts_results = olp.match_group(s[0], (1,))
if ts_results:
p = ts_results[1]
r=self.ol(r,p,self._str(s[1],level))
else:
ts_results = dl.match_group(s[0], (1,2))
if ts_results:
t,d = ts_results[1]
r=self.dl(r,t,d,self._str(s[1],level))
else:
if example(s[0]) >= 0 and s[1]:
# Introduce an example, using pre tags:
r=self.normal(r,s[0],self.pre(s[1]))
else:
if s[0][-2:]=='
::
' and s[1]:
# Introduce an example, using pre tags:
r=self.normal(r,s[0][:-1],self.pre(s[1]))
else:
if nl(s[0]) < 0 and s[1] and s[0][-1:] != '
:
':
# Treat as a heading
t=s[0]
r=self.head(r,t,level,
self._str(s[1],level and level+1))
else:
r=self.normal(r,s[0],self._str(s[1],level))
return r
def html_quote(v,
character_entities=(
(regex.compile('
&
'), '
&
amp
;
'),
(regex.compile("<"), '
&
lt
;
' ),
(regex.compile(">"), '
&
gt
;
' ),
(regex.compile('"'), '"'))): #"
(
ts_
regex.compile('
&
'), '
&
amp
;
'),
(
ts_
regex.compile("<"), '
&
lt
;
' ),
(
ts_
regex.compile(">"), '
&
gt
;
' ),
(
ts_
regex.compile('"'), '"'))): #"
text
=
str
(
v
)
for
re
,
name
in
character_entities
:
text
=
gsub
(
re
,
name
,
text
)
...
...
@@ -633,17 +650,18 @@ def main():
s=sys.stdin.read()
if opts:
import regex, regsub
if filter(lambda o: o[0]=='
-
w
', opts):
print '
Content
-
Type
:
text
/
html
\
n
'
if s[:2]=='
#!':
s
=
regsub
.
sub
(
'^#![^
\
n
]+'
,
''
,
s
)
s
=
ts_regex
.
sub
(
'^#![^
\
n
]+'
,
''
,
s
)
r
=
regex
.
compile
(
'
\
([
\
0-
\
n
]*
\
n
\
)
'
)
if r.match(s) >= 0:
s=s[len(r.group(1)):]
r
=
ts_regex
.
compile
(
'
\
([
\
0-
\
n
]*
\
n
\
)
'
)
ts_results = r.match_group(s, (1,))
if ts_results:
s=s[len(ts_results[1]):]
s=str(html_with_references(s))
if s[:4]=='
<
h1
>
':
t=s[4:find(s,'
</
h1
>
')]
...
...
lib/python/ZPublisher/Client.py
View file @
ac181a2d
...
...
@@ -103,18 +103,17 @@ that allows one to simply make a single web request.
The module also provides a command-line interface for calling objects.
"""
__version__
=
'$Revision: 1.3
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.3
1
$'
[
11
:
-
2
]
import
sys
,
regex
,
socket
,
mimetools
from
httplib
import
HTTP
from
os
import
getpid
from
time
import
time
from
random
import
random
from
regsub
import
gsub
from
base64
import
encodestring
from
urllib
import
urlopen
,
quote
from
types
import
FileType
,
ListType
,
DictType
,
TupleType
from
string
import
strip
,
split
,
atoi
,
join
,
rfind
,
translate
,
maketrans
from
string
import
strip
,
split
,
atoi
,
join
,
rfind
,
translate
,
maketrans
,
replace
from
urlparse
import
urlparse
class
Function
:
...
...
@@ -205,9 +204,9 @@ class Function:
not
headers
.
has_key
(
'Authorization'
)):
headers
[
'Authorization'
]
=
(
"Basic %s"
%
gsub
(
'
\
012
'
,
''
,
encodestring
(
'%s:%s'
%
(
self
.
username
,
self
.
password
)
)))
replace
(
encodestring
(
'%s:%s'
%
(
self
.
username
,
self
.
password
),
'
\
012
'
,
''
)))
try
:
h
=
HTTP
()
h
.
connect
(
self
.
host
,
self
.
port
)
...
...
@@ -268,8 +267,7 @@ class Function:
for
n
,
v
in
self
.
headers
.
items
():
rq
.
append
(
'%s: %s'
%
(
n
,
v
))
if
self
.
username
and
self
.
password
:
c
=
gsub
(
'
\
012
'
,
''
,
encodestring
(
'%s:%s'
%
(
self
.
username
,
self
.
password
)))
c
=
replace
(
encodestring
(
'%s:%s'
%
(
self
.
username
,
self
.
password
)),
'
\
012
'
,
''
)
rq
.
append
(
'Authorization: Basic %s'
%
c
)
rq
.
append
(
MultiPart
(
d
).
render
())
rq
=
join
(
rq
,
'
\
n
'
)
...
...
@@ -480,7 +478,7 @@ class MultiPart:
elif dt==FileType or hasattr(val,'
read
'):
if hasattr(val,'
name
'):
fn=
gsub('
\\\\
','
/
',val.name
)
fn=
replace(val.name, '
\\
', '
/
'
)
fn=fn[(rfind(fn,'
/
')+1):]
ex=fn[(rfind(fn,'
.
')+1):]
if self._extmap.has_key(ex): ct=self._extmap[ex]
...
...
lib/python/webdav/client.py
View file @
ac181a2d
"""HTTP 1.1 / WebDAV client library."""
__version__
=
'$Revision: 1.
9
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
10
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
regex
,
time
,
types
import
socket
,
httplib
,
mimetools
...
...
@@ -10,7 +10,7 @@ from base64 import encodestring
from
cStringIO
import
StringIO
from
whrandom
import
random
from
urllib
import
quote
from
regsub
import
gsub
...
...
@@ -88,9 +88,8 @@ class Resource:
return
headers
if
atype
==
'Basic'
:
headers
[
'Authorization'
]
=
(
"Basic %s"
%
gsub
(
'
\
012
'
,
''
,
encodestring
(
'%s:%s'
%
(
self
.
username
,
self
.
password
))))
"Basic %s"
%
string
.
replace
(
encodestring
(
'%s:%s'
%
(
self
.
username
,
self
.
password
)),
'
\
012
'
,
''
))
return
headers
raise
ValueError
,
'Unknown authentication scheme: %s'
%
atype
...
...
@@ -503,7 +502,7 @@ class MultiPart:
if hasattr(val,'
name
'):
ct, enc=guess_type(val.name)
if not ct: ct='
application
/
octet
-
stream
'
fn=
gsub('
\\\\
','
/
',val.name
)
fn=
string.replace(val.name,'
\\
','
/
'
)
fn=fn[(string.rfind(fn,'
/
')+1):]
else:
ct='
application
/
octet
-
stream
'
...
...
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