[Zodb-checkins] CVS: Zope/lib/python/ZopeUndo - Prefix.py:1.1.22.1 __init__.py:1.1.22.1

Jeremy Hylton jeremy@zope.com
Fri, 15 Nov 2002 12:28:04 -0500


Update of /cvs-repository/Zope/lib/python/ZopeUndo
In directory cvs.zope.org:/tmp/cvs-serv2910/lib/python/ZopeUndo

Added Files:
      Tag: Zope-2_6-branch
	Prefix.py __init__.py 
Log Message:
Add ZopeUndo package to Zope 2.6.

This package is used to allow undo to work when ZEO is running with a
separate lib/python from Zope.


=== Added File Zope/lib/python/ZopeUndo/Prefix.py ===
##############################################################################
#
# 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


=== Added File Zope/lib/python/ZopeUndo/__init__.py ===
##############################################################################
#
# 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
#
##############################################################################