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
Hide 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 @@
##############################################################################
"""Property sheets"""
__version__
=
'$Revision: 1.8
0
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.8
1
$'
[
11
:
-
2
]
import
time
,
string
,
App
.
Management
,
Globals
from
webdav.WriteLockInterface
import
WriteLockInterface
...
...
@@ -26,6 +26,7 @@ from ExtensionClass import Base
from
Globals
import
Persistent
from
Traversable
import
Traversable
from
Acquisition
import
aq_base
from
AccessControl
import
getSecurityManager
class
View
(
App
.
Management
.
Tabs
,
Base
):
"""A view of an object, typically used for management purposes
...
...
@@ -541,13 +542,24 @@ class DAVProperties(Virtual, PropertySheet, View):
' </n:lockentry>
\
n
'
def
dav__lockdiscovery
(
self
):
security
=
getSecurityManager
()
user
=
security
.
getUser
().
getUserName
()
vself
=
self
.
v_self
()
out
=
'
\
n
'
if
WriteLockInterface
.
isImplementedBy
(
vself
):
locks
=
vself
.
wl_lockValues
(
killinvalids
=
1
)
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
return
out
...
...
lib/python/webdav/LockItem.py
View file @
d178a671
...
...
@@ -11,8 +11,7 @@
#
##############################################################################
__version__
=
"$Revision: 1.5 $"
[
11
:
-
2
]
__version__
=
"$Revision: 1.6 $"
[
11
:
-
2
]
from
Globals
import
Persistent
from
WriteLockInterface
import
LockItemInterface
...
...
@@ -142,7 +141,10 @@ class LockItem(Persistent):
def
getLockScope
(
self
):
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
'
' <%(ns)s:locktype><%(ns)s:%(locktype)s/></%(ns)s:locktype>
\
n
'
' <%(ns)s:lockscope><%(ns)s:%(lockscope)s/></%(ns)s:lockscope>
\
n
'
...
...
@@ -160,11 +162,12 @@ class LockItem(Persistent):
'depth'
:
self
.
_depth
,
'owner'
:
self
.
_owner
,
'timeout'
:
self
.
getTimeoutString
(),
'locktoken'
:
self
.
_
token
,
'locktoken'
:
token
,
}
return
s
def
asXML
(
self
):
s
=
"""<?xml version="1.0" encoding="utf-8" ?>
<d:prop xmlns:d="DAV:">
<d:lockdiscovery>
...
...
lib/python/webdav/common.py
View file @
d178a671
...
...
@@ -13,11 +13,14 @@
"""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
from
App.Common
import
iso8601_date
,
rfc850_date
,
rfc1123_date
from
App.Common
import
aq_base
import
random
_randGen
=
random
.
Random
(
time
.
time
())
def
absattr
(
attr
):
if
callable
(
attr
):
...
...
@@ -53,10 +56,10 @@ def urlbase(url, ftype=urllib.splittype, fhost=urllib.splithost):
def
generateLockToken
():
# Generate a lock token
# XXX This is simple right now, just lifted from the original shortcut
# in Resource.dav__genlocktoken, but should be replaced by something
# better.
return
'AA9F6414-1D77-11D3-B825-00105A989226:%.03f'
%
time
.
time
()
return
'%s-%s-00105A989226:%.03f'
%
\
(
_randGen
.
random
(),
_randGen
.
random
(),
time
.
time
())
def
tokenFinder
(
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