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
dabb9766
Commit
dabb9766
authored
Aug 28, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore `__cp` cookie, as it is also used by downstream projects.
parent
86a623e5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
3 deletions
+26
-3
src/OFS/CopySupport.py
src/OFS/CopySupport.py
+26
-3
No files found.
src/OFS/CopySupport.py
View file @
dabb9766
...
...
@@ -13,8 +13,8 @@
"""Copy interface
"""
from
marshal
import
dumps
from
marshal
import
loads
from
json
import
dumps
from
json
import
loads
import
re
import
tempfile
from
urllib
import
quote
...
...
@@ -111,6 +111,10 @@ class CopyContainer(Base):
oblist
.
append
(
m
.
dump
())
cp
=
(
1
,
oblist
)
cp
=
_cb_encode
(
cp
)
if
REQUEST
is
not
None
:
resp
=
REQUEST
[
'RESPONSE'
]
resp
.
setCookie
(
'__cp'
,
cp
,
path
=
'%s'
%
cookie_path
(
REQUEST
))
REQUEST
[
'__cp'
]
=
cp
return
cp
security
.
declareProtected
(
view_management_screens
,
'manage_copyObjects'
)
...
...
@@ -132,6 +136,10 @@ class CopyContainer(Base):
oblist
.
append
(
m
.
dump
())
cp
=
(
0
,
oblist
)
cp
=
_cb_encode
(
cp
)
if
REQUEST
is
not
None
:
resp
=
REQUEST
[
'RESPONSE'
]
resp
.
setCookie
(
'__cp'
,
cp
,
path
=
'%s'
%
cookie_path
(
REQUEST
))
REQUEST
[
'__cp'
]
=
cp
return
cp
def
_get_id
(
self
,
id
):
...
...
@@ -163,6 +171,8 @@ class CopyContainer(Base):
or IObjectWillBeMovedEvent and IObjectMovedEvent.
"""
cp
=
cb_copy_data
if
cp
is
None
and
REQUEST
is
not
None
and
'__cp'
in
REQUEST
:
cp
=
REQUEST
[
'__cp'
]
if
cp
is
None
:
raise
CopyError
(
'No clipboard data found.'
)
...
...
@@ -277,6 +287,13 @@ class CopyContainer(Base):
# try to make ownership implicit if possible
ob
.
manage_changeOwnershipType
(
explicit
=
0
)
if
REQUEST
is
not
None
:
REQUEST
[
'RESPONSE'
].
setCookie
(
'__cp'
,
'deleted'
,
path
=
'%s'
%
cookie_path
(
REQUEST
),
expires
=
'Wed, 31-Dec-97 23:59:59 GMT'
)
REQUEST
[
'__cp'
]
=
None
return
result
security
.
declareProtected
(
view_management_screens
,
'manage_renameObjects'
)
...
...
@@ -540,7 +557,7 @@ def absattr(attr):
def
_cb_encode
(
d
):
return
quote
(
compress
(
dumps
(
d
),
9
))
return
quote
(
compress
(
dumps
(
d
),
2
))
def
_cb_decode
(
s
,
maxsize
=
8192
):
...
...
@@ -549,3 +566,9 @@ def _cb_decode(s, maxsize=8192):
if
dec
.
unconsumed_tail
:
raise
ValueError
return
loads
(
data
)
def
cookie_path
(
request
):
# Return a "path" value for use in a cookie that refers
# to the root of the Zope object space.
return
request
[
'BASEPATH1'
]
or
"/"
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