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
d178a671
Commit
d178a671
authored
Jan 09, 2002
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Collector #126: merge from 2.5 branch fixes LOCK-stealing problem
with cadaver
parent
bca3e8d5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
lib/python/OFS/PropertySheets.py
lib/python/OFS/PropertySheets.py
+14
-2
lib/python/webdav/LockItem.py
lib/python/webdav/LockItem.py
+7
-4
lib/python/webdav/common.py
lib/python/webdav/common.py
+8
-5
No files found.
lib/python/OFS/PropertySheets.py
View file @
d178a671
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
##############################################################################
##############################################################################
"""Property sheets"""
"""Property sheets"""
__version__
=
'$Revision: 1.8
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.8
1
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
,
Globals
import
time
,
string
,
App
.
Management
,
Globals
from
webdav.WriteLockInterface
import
WriteLockInterface
from
webdav.WriteLockInterface
import
WriteLockInterface
...
@@ -26,6 +26,7 @@ from ExtensionClass import Base
...
@@ -26,6 +26,7 @@ from ExtensionClass import Base
from
Globals
import
Persistent
from
Globals
import
Persistent
from
Traversable
import
Traversable
from
Traversable
import
Traversable
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
AccessControl
import
getSecurityManager
class
View
(
App
.
Management
.
Tabs
,
Base
):
class
View
(
App
.
Management
.
Tabs
,
Base
):
"""A view of an object, typically used for management purposes
"""A view of an object, typically used for management purposes
...
@@ -541,13 +542,24 @@ class DAVProperties(Virtual, PropertySheet, View):
...
@@ -541,13 +542,24 @@ class DAVProperties(Virtual, PropertySheet, View):
' </n:lockentry>
\
n
'
' </n:lockentry>
\
n
'
def
dav__lockdiscovery
(
self
):
def
dav__lockdiscovery
(
self
):
security
=
getSecurityManager
()
user
=
security
.
getUser
().
getUserName
()
vself
=
self
.
v_self
()
vself
=
self
.
v_self
()
out
=
'
\
n
'
out
=
'
\
n
'
if
WriteLockInterface
.
isImplementedBy
(
vself
):
if
WriteLockInterface
.
isImplementedBy
(
vself
):
locks
=
vself
.
wl_lockValues
(
killinvalids
=
1
)
locks
=
vself
.
wl_lockValues
(
killinvalids
=
1
)
for
lock
in
locks
:
for
lock
in
locks
:
out
=
'%s
\
n
%s'
%
(
out
,
lock
.
asLockDiscoveryProperty
(
'n'
))
creator
=
lock
.
getCreator
()[
-
1
]
if
creator
==
user
:
fake
=
0
else
:
fake
=
1
out
=
'%s
\
n
%s'
%
(
out
,
lock
.
asLockDiscoveryProperty
(
'n'
,
fake
=
fake
))
out
=
'%s
\
n
'
%
out
out
=
'%s
\
n
'
%
out
return
out
return
out
...
...
lib/python/webdav/LockItem.py
View file @
d178a671
...
@@ -11,8 +11,7 @@
...
@@ -11,8 +11,7 @@
#
#
##############################################################################
##############################################################################
__version__
=
"$Revision: 1.5 $"
[
11
:
-
2
]
__version__
=
"$Revision: 1.6 $"
[
11
:
-
2
]
from
Globals
import
Persistent
from
Globals
import
Persistent
from
WriteLockInterface
import
LockItemInterface
from
WriteLockInterface
import
LockItemInterface
...
@@ -142,7 +141,10 @@ class LockItem(Persistent):
...
@@ -142,7 +141,10 @@ class LockItem(Persistent):
def
getLockScope
(
self
):
def
getLockScope
(
self
):
return
self
.
_lockscope
return
self
.
_lockscope
def
asLockDiscoveryProperty
(
self
,
ns
=
'd'
):
def
asLockDiscoveryProperty
(
self
,
ns
=
'd'
,
fake
=
0
):
if
fake
:
token
=
'this-is-a-faked-no-permission-token'
else
:
token
=
self
.
_token
s
=
(
' <%(ns)s:activelock>
\
n
'
s
=
(
' <%(ns)s:activelock>
\
n
'
' <%(ns)s:locktype><%(ns)s:%(locktype)s/></%(ns)s:locktype>
\
n
'
' <%(ns)s:locktype><%(ns)s:%(locktype)s/></%(ns)s:locktype>
\
n
'
' <%(ns)s:lockscope><%(ns)s:%(lockscope)s/></%(ns)s:lockscope>
\
n
'
' <%(ns)s:lockscope><%(ns)s:%(lockscope)s/></%(ns)s:lockscope>
\
n
'
...
@@ -160,11 +162,12 @@ class LockItem(Persistent):
...
@@ -160,11 +162,12 @@ class LockItem(Persistent):
'depth'
:
self
.
_depth
,
'depth'
:
self
.
_depth
,
'owner'
:
self
.
_owner
,
'owner'
:
self
.
_owner
,
'timeout'
:
self
.
getTimeoutString
(),
'timeout'
:
self
.
getTimeoutString
(),
'locktoken'
:
self
.
_
token
,
'locktoken'
:
token
,
}
}
return
s
return
s
def
asXML
(
self
):
def
asXML
(
self
):
s
=
"""<?xml version="1.0" encoding="utf-8" ?>
s
=
"""<?xml version="1.0" encoding="utf-8" ?>
<d:prop xmlns:d="DAV:">
<d:prop xmlns:d="DAV:">
<d:lockdiscovery>
<d:lockdiscovery>
...
...
lib/python/webdav/common.py
View file @
d178a671
...
@@ -13,11 +13,14 @@
...
@@ -13,11 +13,14 @@
"""Commonly used functions for WebDAV support modules."""
"""Commonly used functions for WebDAV support modules."""
__version__
=
'$Revision: 1.1
4
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
5
$'
[
11
:
-
2
]
import
time
,
urllib
,
re
import
time
,
urllib
,
re
from
App.Common
import
iso8601_date
,
rfc850_date
,
rfc1123_date
from
App.Common
import
iso8601_date
,
rfc850_date
,
rfc1123_date
from
App.Common
import
aq_base
from
App.Common
import
aq_base
import
random
_randGen
=
random
.
Random
(
time
.
time
())
def
absattr
(
attr
):
def
absattr
(
attr
):
if
callable
(
attr
):
if
callable
(
attr
):
...
@@ -53,10 +56,10 @@ def urlbase(url, ftype=urllib.splittype, fhost=urllib.splithost):
...
@@ -53,10 +56,10 @@ def urlbase(url, ftype=urllib.splittype, fhost=urllib.splithost):
def
generateLockToken
():
def
generateLockToken
():
# Generate a lock token
# Generate a lock token
# XXX This is simple right now, just lifted from the original shortcut
return
'%s-%s-00105A989226:%.03f'
%
\
# in Resource.dav__genlocktoken, but should be replaced by something
(
_randGen
.
random
(),
_randGen
.
random
(),
time
.
time
())
# better.
return
'AA9F6414-1D77-11D3-B825-00105A989226:%.03f'
%
time
.
time
()
def
tokenFinder
(
token
):
def
tokenFinder
(
token
):
# takes a string like '<opaquelocktoken:afsdfadfadf> and returns the token
# takes a string like '<opaquelocktoken:afsdfadfadf> and returns the token
...
...
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