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
b1f87d67
Commit
b1f87d67
authored
Jun 12, 2002
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a subtransaction to ensure the data being copied is current and to get
the _p_jar attributes set.
parent
e7fe1383
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
lib/python/OFS/CopySupport.py
lib/python/OFS/CopySupport.py
+16
-3
No files found.
lib/python/OFS/CopySupport.py
View file @
b1f87d67
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
#
#
##############################################################################
##############################################################################
__doc__
=
"""Copy interface"""
__doc__
=
"""Copy interface"""
__version__
=
'$Revision: 1.
79
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.
80
$'
[
11
:
-
2
]
import
sys
,
Globals
,
Moniker
,
tempfile
,
ExtensionClass
import
sys
,
Globals
,
Moniker
,
tempfile
,
ExtensionClass
from
marshal
import
loads
,
dumps
from
marshal
import
loads
,
dumps
...
@@ -398,6 +398,21 @@ class CopySource(ExtensionClass.Base):
...
@@ -398,6 +398,21 @@ class CopySource(ExtensionClass.Base):
pass
pass
def
_getCopy
(
self
,
container
):
def
_getCopy
(
self
,
container
):
# Commit a subtransaction to:
# 1) Make sure the data about to be exported is current
# 2) Ensure self._p_jar and container._p_jar are set even if
# either one is a new object
get_transaction
().
commit
(
1
)
if
self
.
_p_jar
is
None
:
raise
CopyError
,
(
'Object "%s" needs to be in the database to be copied'
%
`self`
)
if
container
.
_p_jar
is
None
:
raise
CopyError
,
(
'Container "%s" needs to be in the database'
%
`container`
)
# Ask an object for a new copy of itself.
# Ask an object for a new copy of itself.
f
=
tempfile
.
TemporaryFile
()
f
=
tempfile
.
TemporaryFile
()
self
.
_p_jar
.
exportFile
(
self
.
_p_oid
,
f
)
self
.
_p_jar
.
exportFile
(
self
.
_p_oid
,
f
)
...
@@ -419,8 +434,6 @@ class CopySource(ExtensionClass.Base):
...
@@ -419,8 +434,6 @@ class CopySource(ExtensionClass.Base):
# Is object copyable? Returns 0 or 1
# Is object copyable? Returns 0 or 1
if
not
(
hasattr
(
self
,
'_canCopy'
)
and
self
.
_canCopy
(
0
)):
if
not
(
hasattr
(
self
,
'_canCopy'
)
and
self
.
_canCopy
(
0
)):
return
0
return
0
if
hasattr
(
self
,
'_p_jar'
)
and
self
.
_p_jar
is
None
:
return
0
if
not
self
.
cb_userHasCopyOrMovePermission
():
if
not
self
.
cb_userHasCopyOrMovePermission
():
return
0
return
0
return
1
return
1
...
...
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