Commit b64d332a authored by Hanno Schlichting's avatar Hanno Schlichting

Updated to ZODB 3.9.0a10. ZODB-level version support has been removed and...

Updated to ZODB 3.9.0a10. ZODB-level version support has been removed and ZopeUndo now is part of Zope2.
parent 61cab06e
......@@ -9,6 +9,9 @@ Zope Changes
Restructuring
- Updated to ZODB 3.9.0a10. ZODB-level version support has been
removed and ZopeUndo now is part of Zope2.
- The Zope2 SVN trunk is now a buildout pulling in all dependencies as
actual released packages and not SVN externals anymore.
......
......@@ -117,8 +117,7 @@ class Historical(Base):
first=request.get('first_transaction', first)
last=request.get('last_transaction',last)
r=self._p_jar.db().history(self._p_oid, None, last)
r=self._p_jar.db().history(self._p_oid, size=last)
if r is None:
# storage doesn't support history
return ()
......
......@@ -38,7 +38,6 @@ def exportXML(jar, oid, file=None):
elif type(file) is str: file=open(file,'w+b')
write=file.write
write('<?xml version="1.0"?>\012<ZopeData>\012')
version=jar._version
ref=referencesf
oids=[oid]
done_oids={}
......@@ -49,8 +48,15 @@ def exportXML(jar, oid, file=None):
del oids[0]
if done(oid): continue
done_oids[oid]=1
try: p, serial = load(oid, version)
except: pass # Ick, a broken reference
try:
try:
p, serial = load(oid)
except TypeError:
# Some places inside the ZODB 3.9 still want a version
# argument, for example TmpStore from Connection.py
p, serial = load(oid, None)
except:
pass # Ick, a broken reference
else:
ref(p, oids)
write(XMLrecord(oid,len(p),p))
......
......@@ -60,7 +60,7 @@ class HistoryTests(unittest.TestCase):
for i in range(3):
entry = r[i]
# check no new keys show up without testing
self.assertEqual(len(entry.keys()),7)
self.assertEqual(len(entry.keys()),6)
# the transactions are in newest-first order
self.assertEqual(entry['description'],'Change %i' % (3-i))
self.failUnless('key' in entry)
......@@ -72,8 +72,7 @@ class HistoryTests(unittest.TestCase):
# check times are increasing
self.failUnless(entry['time']<r[i-1]['time'])
self.assertEqual(entry['user_name'],'')
self.assertEqual(entry['version'],'')
def test_manage_historyCopy(self):
# we assume this works 'cos it's tested above
r = self.ps.manage_change_history()
......
......@@ -72,15 +72,9 @@ class MountedTemporaryFolder(MountPoint, Item):
manage_traceback = DTMLFile('dtml/mountfail', globals())
def _createDB(self, db=None): # huh? db=db was original
def _createDB(self):
""" Create a mounted RAM database """
db = DB(TemporaryStorage())
# the connection in 2.5.X - 2.6.1 was a "low conflict connection",
# but this caused synchronization problems. For 2.6.2, we want
# to reenable read conflict errors, so we use a default connection
# type.
#db.klass = LowConflictConnection
return db
return DB(TemporaryStorage())
def _getMountRoot(self, root):
sdc = root.get('folder', None)
......
......@@ -139,7 +139,7 @@ class MountPoint(persistent.Persistent, Implicit):
if jar is None:
# Get _p_jar from parent.
self._p_jar = jar = parent._p_jar
conn = db.open(version=jar.getVersion())
conn = db.open()
# Add an attribute to the connection which
# makes it possible for us to find the primary
......
......@@ -37,7 +37,7 @@ class TestDBConfig:
def __init__(self, fname, mpoints):
self.fname = fname
self.mpoints = mpoints
def getDB(self):
from ZODB.config import DemoStorage
from ZODB.Connection import Connection
......@@ -45,18 +45,25 @@ class TestDBConfig:
self.name = self.fname
self.base = None
self.path = os.path.join(os.path.dirname(__file__), self.fname)
self.create = None
self.read_only = None
self.quota = None
self.cache_size = 5000
self.pool_size = 7
self.version_pool_size = 3
self.version_cache_size = 100
self.mount_points = self.mpoints
self.connection_class = Connection
self.cache_size_bytes = 0
self.class_factory = None
self.storage = DemoStorage(self)
self.connection_class = Connection
self.container_class = None
self.create = None
self.factories = ()
self.historical_pool_size = 3
self.historical_cache_size = 1000
self.historical_cache_size_bytes = 0
self.historical_timeout = 300
self.mount_points = self.mpoints
self.pool_size = 7
self.pool_timeout = 1<<31
self.quota = None
self.read_only = None
self.storage = DemoStorage(self)
self.version_cache_size = 100
self.version_pool_size = 3
return ZopeDatabase(self)
def getSectionName(self):
......
......@@ -30,6 +30,7 @@ from App.config import getConfiguration
TEMPNAME = tempfile.mktemp()
TEMPPRODUCTS = os.path.join(TEMPNAME, "Products")
TEMPVAR = os.path.join(TEMPNAME, "var")
def getSchema():
startup = os.path.dirname(os.path.realpath(Zope2.Startup.__file__))
......@@ -57,10 +58,12 @@ class StartupTestCase(unittest.TestCase):
text.replace("<<INSTANCE_HOME>>", TEMPNAME))
os.mkdir(TEMPNAME)
os.mkdir(TEMPPRODUCTS)
os.mkdir(TEMPVAR)
try:
conf, handler = ZConfig.loadConfigFile(schema, sio)
finally:
os.rmdir(TEMPPRODUCTS)
os.rmdir(TEMPVAR)
os.rmdir(TEMPNAME)
self.assertEqual(conf.instancehome, TEMPNAME)
return conf, handler
......@@ -198,8 +201,6 @@ class StartupTestCase(unittest.TestCase):
mount-point /
cache-size 5000
pool-size 7
version-pool-size 3
version-cache-size 100
</zodb_db>
""")
self.assertEqual(conf.databases[0].config.connection_class.__name__,
......
##############################################################################
#
# 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.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 Corporation 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 Corporation 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 Corporation 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)
......@@ -11,8 +11,6 @@ ExtensionClass = 2.11.1
Persistence = 2.11.1
tempstorage = 2.11.1
zLOG = 2.11.1
ZODB3 = 3.8.1
# ZODB3 = 3.9.0a10 - this causes some errors for the removed versions support
zc.lockfile = 1.0
transaction = 1.0a1
zope.broken = 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