Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZODB
Commits
dcfb7c76
Commit
dcfb7c76
authored
Oct 03, 2002
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create new ZopeUndo package.
parent
f3b2414e
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
0 deletions
+102
-0
src/ZopeUndo/Prefix.py
src/ZopeUndo/Prefix.py
+40
-0
src/ZopeUndo/__init__.py
src/ZopeUndo/__init__.py
+13
-0
src/ZopeUndo/tests/__init__.py
src/ZopeUndo/tests/__init__.py
+13
-0
src/ZopeUndo/tests/testPrefix.py
src/ZopeUndo/tests/testPrefix.py
+36
-0
No files found.
src/ZopeUndo/Prefix.py
0 → 100644
View file @
dcfb7c76
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""ZODB undo support for Zope.
This package is used to support the Prefix object that Zope uses for
undo. It is a separate package only to aid configuration management.
This package is included in Zope and ZODB3, so that ZODB3 is suitable
for running a ZEO server that handles Zope undo.
"""
class
Prefix
:
"""A Prefix() is equal to any string it as a prefix of.
This class can be compared to a string (or arbitrary sequence).
The comparison will return True if the prefix value is a prefix of
the string being compared.
Two prefixes can not be compared.
"""
__no_side_effects__
=
1
def
__init__
(
self
,
path
):
self
.
value
=
len
(
path
),
path
def
__cmp__
(
self
,
o
):
l
,
v
=
self
.
value
rval
=
cmp
(
o
[:
l
],
v
)
return
rval
src/ZopeUndo/__init__.py
0 → 100644
View file @
dcfb7c76
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
src/ZopeUndo/tests/__init__.py
0 → 100644
View file @
dcfb7c76
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
src/ZopeUndo/tests/testPrefix.py
0 → 100644
View file @
dcfb7c76
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
from
ZopeUndo.Prefix
import
Prefix
import
unittest
class
PrefixTest
(
unittest
.
TestCase
):
def
test
(
self
):
p1
=
(
Prefix
(
"/a/b"
),
(
"/a/b"
,
"/a/b/c"
,
"/a/b/c/d"
),
(
""
,
"/a/c"
))
p2
=
(
Prefix
(
""
),
(
""
,
"/def"
,
"/a/b"
,
"/a/b/c"
,
"/a/b/c/d"
),
())
for
prefix
,
equal
,
notequal
in
p1
,
p2
:
for
s
in
equal
:
self
.
assertEqual
(
prefix
,
s
)
for
s
in
notequal
:
self
.
assertNotEqual
(
prefix
,
s
)
def
test_suite
():
return
unittest
.
makeSuite
(
PrefixTest
)
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