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
fd552539
Commit
fd552539
authored
Mar 11, 1999
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixups
parent
4cce4261
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
42 deletions
+36
-42
lib/python/webdav/NullResource.py
lib/python/webdav/NullResource.py
+3
-3
lib/python/webdav/Resource.py
lib/python/webdav/Resource.py
+15
-3
lib/python/webdav/xmlcmds.py
lib/python/webdav/xmlcmds.py
+4
-2
lib/python/webdav/xmltools.py
lib/python/webdav/xmltools.py
+14
-34
No files found.
lib/python/webdav/NullResource.py
View file @
fd552539
...
...
@@ -85,7 +85,7 @@
"""WebDAV support - null resource objects."""
__version__
=
'$Revision: 1.1
2
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
3
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
mimetypes
import
Acquisition
,
OFS
.
content_types
...
...
@@ -99,7 +99,7 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
"""Null resources are used to handle HTTP method calls on
objects which do not yet exist in the url namespace."""
__
dav_null
__
=
1
__
null_resource
__
=
1
__ac_permissions__
=
(
(
'View'
,
(
'HEAD'
,)),
...
...
@@ -169,7 +169,7 @@ class NullResource(Persistent, Acquisition.Implicit, Resource):
if
hasattr
(
aq_base
(
parent
),
name
):
raise
'Method Not Allowed'
,
'The name %s is in use.'
%
name
if
not
hasattr
(
parent
,
'__dav_collection__'
):
raise
'Forbidden'
,
'
Unable to create collection resource
.'
raise
'Forbidden'
,
'
Cannot create collection at this location
.'
parent
.
manage_addFolder
(
name
)
RESPONSE
.
setStatus
(
201
)
RESPONSE
.
setBody
(
''
)
...
...
lib/python/webdav/Resource.py
View file @
fd552539
...
...
@@ -85,12 +85,24 @@
"""WebDAV support - resource objects."""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
mimetypes
,
xmlcmds
from
common
import
absattr
,
aq_base
,
urlfix
,
rfc1123_date
import
exceptions
class
error
(
exceptions
.
Exception
):
def
__init__
(
self
,
msg
):
self
.
msg
=
msg
html
=
'<html>
\
n
<head>
\
n
<title></title>
\
n
</head>
\
n
<body>
\
n
'
\
'%s
\
n
</body></html>'
def
__str__
(
self
,
fmt
=
html
):
return
fmt
%
self
.
msg
class
Resource
:
"""The Resource mixin class provides basic WebDAV support for
non-collection objects. It provides default implementations
...
...
@@ -240,7 +252,7 @@ class Resource:
except
'Not Found'
:
raise
'Conflict'
,
'Object ancestors must already exist.'
except
:
raise
sys
.
exc_type
,
sys
.
exc_value
if
hasattr
(
parent
,
'__
dav_null
__'
):
if
hasattr
(
parent
,
'__
null_resource
__'
):
raise
'Conflict'
,
'Object ancestors must already exist.'
existing
=
hasattr
(
aq_base
(
parent
),
name
)
if
existing
and
oflag
==
'F'
:
...
...
@@ -294,7 +306,7 @@ class Resource:
except
'Not Found'
:
raise
'Conflict'
,
'The resource %s must exist.'
%
path
except
:
raise
sys
.
exc_type
,
sys
.
exc_value
if
hasattr
(
parent
,
'__
dav_null
__'
):
if
hasattr
(
parent
,
'__
null_resource
__'
):
raise
'Conflict'
,
'The resource %s must exist.'
%
path
existing
=
hasattr
(
aq_base
(
parent
),
name
)
if
existing
and
flag
==
'F'
:
...
...
lib/python/webdav/xmlcmds.py
View file @
fd552539
...
...
@@ -85,7 +85,7 @@
"""WebDAV xml request objects."""
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
6
$'
[
11
:
-
2
]
import
sys
,
os
,
string
from
common
import
absattr
,
aq_base
,
urlfix
...
...
@@ -96,7 +96,9 @@ from cStringIO import StringIO
class
DAVProps
(
DAVProperties
):
"""Emulate required DAV properties for objects which do
not themselves support properties."""
not themselves support properties. This is mainly so
that non-PropertyManagers can appear to support DAV
PROPFIND requests."""
def
__init__
(
self
,
obj
):
self
.
__obj__
=
obj
def
v_self
(
self
):
...
...
lib/python/webdav/xmltools.py
View file @
fd552539
...
...
@@ -83,9 +83,13 @@
#
##############################################################################
"""WebDAV XML parsing tools."""
"""WebDAV XML parsing tools. Note that this module does just
enough for the purposes of DAV - it is not intended as a
general xml toolkit, and will probably eventually go away
in favor of a standard xml package once some issues are
worked out."""
__version__
=
'$Revision: 1.
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
5
$'
[
11
:
-
2
]
import
sys
,
os
,
string
,
xmllib
from
Acquisition
import
Implicit
...
...
@@ -311,7 +315,6 @@ class Text(Node):
def
toxml
(
self
):
return
escape
(
self
.
__value__
)
class
CData
(
Node
):
__type__
=
type_cdata
__name__
=
'#cdata'
...
...
@@ -320,27 +323,19 @@ class CData(Node):
def
toxml
(
self
):
return
'<![CDATA[%s]]>'
%
self
.
__value__
class
EntityRef
(
Node
):
__name__
=
'#entityref'
__type__
=
type_entityref
def
__init__
(
self
,
val
):
self
.
__value__
=
val
self
.
__value__
=
val
def
toxml
(
self
):
return
'&%s;'
%
self
.
__value__
class
Entity
(
Node
):
__name__
=
'#entity'
__type__
=
type_entity
def
__init__
(
self
,
name
,
pubid
,
sysid
,
nname
):
self
.
__value__
=
val
def
toxml
(
self
):
return
''
...
...
@@ -349,18 +344,14 @@ class ProcInst(Node):
def
__init__
(
self
,
name
,
val
):
self
.
__name__
=
name
self
.
__value__
=
val
def
toxml
(
self
):
return
'<?%s %s?>'
%
(
self
.
__name__
,
self
.
__value__
)
class
Comment
(
Node
):
__name__
=
'#comment'
__type__
=
type_comment
def
__init__
(
self
,
val
):
self
.
__value__
=
val
def
toxml
(
self
):
return
'<!--%s-->'
%
self
.
__value__
...
...
@@ -425,26 +416,15 @@ class XmlParser(xmllib.XMLParser):
def
escape
(
data
,
entities
=
{}):
# snarfed from xml.util...
data
=
string
.
replace
(
data
,
"&"
,
"&"
)
data
=
string
.
replace
(
data
,
"<"
,
"<"
)
data
=
string
.
replace
(
data
,
">"
,
">"
)
for
chars
,
entity
in
entities
.
items
():
data
=
string
.
replace
(
data
,
chars
,
entity
)
def
escape
(
data
,
rmap
=
{},
replace
=
string
.
replace
):
data
=
replace
(
data
,
"&"
,
"&"
)
data
=
replace
(
data
,
"<"
,
"<"
)
data
=
replace
(
data
,
">"
,
">"
)
for
key
,
val
in
rmap
.
items
():
data
=
replace
(
data
,
key
,
val
)
return
data
def
remap
(
data
):
def
remap
(
data
,
dict
=
{
'DAV:'
:
'd'
}
):
root
=
XmlParser
().
parse
(
data
)
dict
=
{
'DAV:'
:
'd'
,
'http://www.zope.org/propsets/default'
:
'z'
}
root
.
elements
()[
0
].
remap
(
dict
,
0
)
return
root
.
toxml
()
def
remap_test
():
file
=
open
(
'big.xml'
,
'r'
)
data
=
file
.
read
()
file
.
close
()
data
=
remap
(
data
)
file
=
open
(
'new.xml'
,
'w'
)
file
.
write
(
data
)
file
.
close
()
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