Commit b6fe0177 authored by Hanno Schlichting's avatar Hanno Schlichting

Factored out ZopeUndo package into a separate distribution.

parent c3b89cf6
...@@ -46,6 +46,7 @@ eggs = ...@@ -46,6 +46,7 @@ eggs =
five.formlib five.formlib
tempstorage tempstorage
zLOG zLOG
ZopeUndo
zope.annotation zope.annotation
zope.authentication zope.authentication
zope.broken zope.broken
......
...@@ -23,6 +23,8 @@ Features Added ...@@ -23,6 +23,8 @@ Features Added
- Persistence = 2.12.0 - Persistence = 2.12.0
- pytz = 2010b - pytz = 2010b
- Factored out ZopeUndo package into a separate distribution.
- There is now an event ZPublisher.interfaces.IPubBeforeStreaming which will - There is now an event ZPublisher.interfaces.IPubBeforeStreaming which will
be fired just before the first chunk of data is written to the response be fired just before the first chunk of data is written to the response
stream when using the write() method on the response. This is the last stream when using the write() method on the response. This is the last
......
...@@ -93,6 +93,7 @@ params = dict(name='Zope2', ...@@ -93,6 +93,7 @@ params = dict(name='Zope2',
'RestrictedPython', 'RestrictedPython',
'ZConfig', 'ZConfig',
'ZODB3', 'ZODB3',
'ZopeUndo',
'docutils', 'docutils',
'five.formlib', 'five.formlib',
'pytz', 'pytz',
......
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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 Zope2.
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 path it is a prefix of.
This class can be compared to a string.
The comparison will return True if all path elements of the
Prefix are found at the beginning of the string being compared.
Two Prefixes can not be compared.
"""
__no_side_effects__ = 1
def __init__(self, path):
path_list = path.split('/')
self.length = len(path_list)
self.path = path_list
def __cmp__(self, o):
other_path = o.split('/')
if other_path and ' ' in other_path[-1]:
# don't include logged username in comparison
pos = other_path[-1].rfind(' ')
other_path[-1] = other_path[-1][:pos]
return cmp(other_path[:self.length], self.path)
def __repr__(self):
# makes failing tests easier to read
return "Prefix('%s')" % '/'.join(self.path)
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
#
##############################################################################
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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
#
##############################################################################
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (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")
for equal in ("/a/b", "/a/b/c", "/a/b/c/d"):
self.assertEqual(p1, equal)
for notEqual in ("", "/a/c", "/a/bbb", "///"):
self.assertNotEqual(p1, notEqual)
p2 = Prefix("")
for equal in ("", "/", "/def", "/a/b", "/a/b/c", "/a/b/c/d"):
self.assertEqual(p2, equal)
def test_username_info(self):
# Zope Collector 1810; user paths have username appended
p1 = Prefix('/a/b')
for equal in ('/a/b spam', '/a/b/c spam', '/a/b/c/b spam'):
self.assertEqual(p1, equal)
for notEqual in (" spam", "/a/c spam", "/a/bbb spam", "/// spam"):
self.assertNotEqual(p1, notEqual)
p2 = Prefix("")
for equal in (" eggs", "/ eggs", "/def eggs", "/a/b eggs",
"/a/b/c eggs", "/a/b/c/d eggs"):
self.assertEqual(p2, equal)
def test_suite():
return unittest.makeSuite(PrefixTest)
...@@ -26,6 +26,7 @@ zdaemon = 2.0.4 ...@@ -26,6 +26,7 @@ zdaemon = 2.0.4
zLOG = 2.11.1 zLOG = 2.11.1
ZODB3 = 3.9.4 ZODB3 = 3.9.4
zodbcode = 3.4.0 zodbcode = 3.4.0
ZopeUndo = 2.12.0
zope.annotation = 3.4.2 zope.annotation = 3.4.2
zope.app.apidoc = 3.6.2 zope.app.apidoc = 3.6.2
zope.app.applicationcontrol = 3.5.0 zope.app.applicationcontrol = 3.5.0
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment