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
8b552c65
Commit
8b552c65
authored
Jan 12, 1998
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional changes to support supplying batch size as a parameter.
parent
39470302
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
15 deletions
+47
-15
lib/python/App/Undo.py
lib/python/App/Undo.py
+35
-10
lib/python/App/undo.dtml
lib/python/App/undo.dtml
+12
-5
No files found.
lib/python/App/Undo.py
View file @
8b552c65
...
...
@@ -11,8 +11,8 @@
__doc__
=
'''short description
$Id: Undo.py,v 1.
7 1998/01/12 16:50:32
jim Exp $'''
__version__
=
'$Revision: 1.
7
$'
[
11
:
-
2
]
$Id: Undo.py,v 1.
8 1998/01/12 17:58:39
jim Exp $'''
__version__
=
'$Revision: 1.
8
$'
[
11
:
-
2
]
import
Globals
from
DateTime
import
DateTime
...
...
@@ -20,25 +20,47 @@ from string import atof, find, atoi, split, rfind
class
UndoSupport
:
manage_UndoForm
=
Globals
.
HTMLFile
(
'undo'
,
globals
(),
batch_size
=
20
,
first_transaction
=
0
,
last_transaction
=
20
)
manage_UndoForm
=
Globals
.
HTMLFile
(
'undo'
,
globals
(),
PrincipiaUndoBatchSize
=
20
,
first_transaction
=
0
,
last_transaction
=
20
)
def
get_request_var_or_attr
(
self
,
name
,
default
):
if
hasattr
(
self
,
'REQUEST'
):
REQUEST
=
self
.
REQUEST
if
REQUEST
.
has_key
(
name
):
return
REQUEST
[
name
]
if
hasattr
(
self
,
name
):
v
=
getattr
(
self
,
name
)
else
:
v
=
default
REQUEST
[
name
]
=
v
return
v
else
:
if
hasattr
(
self
,
name
):
v
=
getattr
(
self
,
name
)
else
:
v
=
default
return
v
def
undoable_transactions
(
self
,
AUTHENTICATION_PATH
=
None
,
first_transaction
=
None
,
last_transaction
=
None
,
batch_size
=
20
):
PrincipiaUndoBatchSize
=
None
):
if
AUTHENTICATION_PATH
is
None
:
path
=
self
.
REQUEST
[
'AUTHENTICATION_PATH'
]
else
:
path
=
AUTHENTICATION_PATH
if
first_transaction
is
None
:
try
:
first_transaction
=
self
.
REQUEST
[
'first_transaction'
]
except
:
first_transaction
=
0
first_transaction
=
self
.
get_request_var_or_attr
(
'first_transaction'
,
0
)
if
PrincipiaUndoBatchSize
is
None
:
PrincipiaUndoBatchSize
=
self
.
get_request_var_or_attr
(
'PrincipiaUndoBatchSize'
,
20
)
if
last_transaction
is
None
:
try
:
last_transaction
=
self
.
REQUEST
[
'last_transaction'
]
except
:
last_transaction
=
first_transaction
+
batch_size
last_transaction
=
self
.
get_request_var_or_attr
(
'last_transaction'
,
first_transaction
+
PrincipiaUndoBatchSize
)
db
=
self
.
_p_jar
.
db
...
...
@@ -90,6 +112,9 @@ Globals.default__class_init__(UndoSupport)
##############################################################################
#
# $Log: Undo.py,v $
# Revision 1.8 1998/01/12 17:58:39 jim
# Additional changes to support supplying batch size as a parameter.
#
# Revision 1.7 1998/01/12 16:50:32 jim
# Made some changes to enhance batch processing.
# Batch size is also now a parameter.
...
...
lib/python/App/undo.dtml
View file @
8b552c65
...
...
@@ -17,14 +17,18 @@
button to undo the transactions. Note that even though a transaction
is shown below, you will not be able to undo it if later transactions
modified objects that were modified by the transaction.
<table>
<tr><td colspan=2 align=center><INPUT TYPE="SUBMIT" VALUE=" Undo "></td></tr>
<tr><td colspan=2 align=center><INPUT TYPE="SUBMIT" VALUE=" Undo ">
</td></tr>
<tr><td></td></tr>
<!--#if first_transaction-->
<tr><td colspan=2 align=center>
<a href="manage_UndoForm?first_transaction:int=<!--#var
expr="first_transaction*2-last_transaction"
-->&last_transaction:int=<!--#var first_transaction-->">
-->&last_transaction:int=<!--#var first_transaction
-->&PrincipiaUndoBatchSize:int=<!--#var PrincipiaUndoBatchSize
-->">
Later Transactions</h>
</td></tr>
<!--#/if-->
...
...
@@ -45,15 +49,18 @@
</tr>
<!--#/in-->
<tr><td colspan=2 align=center>
<!--#if expr="_.len(undoable_transactions) ==
batch_s
ize"-->
<!--#if expr="_.len(undoable_transactions) ==
PrincipiaUndoBatchS
ize"-->
<a href="manage_UndoForm?first_transaction:int=<!--#var
last_transaction-->&last_transaction:int=<!--#var
expr="last_transaction+batch_size"-->">
expr="last_transaction+PrincipiaUndoBatchSize"
-->&PrincipiaUndoBatchSize:int=<!--#var PrincipiaUndoBatchSize
-->">
Earlier Transactions</a>
<!--#/if-->
</td></tr>
<tr><td></td></tr>
<tr><td colspan=2 align=center><INPUT TYPE="SUBMIT" VALUE=" Undo "></td></tr>
<tr><td colspan=2 align=center><INPUT TYPE="SUBMIT" VALUE=" Undo ">
</td></tr>
</table>
</FORM>
...
...
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