changes to allow zodbupdate to migrate old data

This commit is contained in:
Helmut Merz 2024-10-02 09:08:16 +02:00
parent 8a6277fbff
commit 814d7c0762
3 changed files with 15 additions and 11 deletions

View file

@ -4,17 +4,17 @@
""" """
import os, re import os, re
import compiler.pycodegen #import compiler.pycodegen
from io import StringIO from io import StringIO
from persistent import Persistent from persistent import Persistent
import RestrictedPython.RCompile #import RestrictedPython.RCompile
from RestrictedPython.SelectCompiler import ast #from RestrictedPython.SelectCompiler import ast
from zope.app.container.btree import BTreeContainer from zope.container.btree import BTreeContainer
from zope.app.container.contained import Contained from zope.container.contained import Contained
from zope.interface import implementer from zope.interface import implementer
from zope.proxy import removeAllProxies from zope.proxy import removeAllProxies
from zope.security.untrustedpython.builtins import SafeBuiltins #from zope.security.untrustedpython.builtins import SafeBuiltins
from zope.security.untrustedpython.rcompile import RestrictionMutator as BaseRM #from zope.security.untrustedpython.rcompile import RestrictionMutator as BaseRM
from zope.traversing.api import getParent, getPath from zope.traversing.api import getParent, getPath
from cybertools.pyscript.interfaces import IPythonScript, IScriptContainer from cybertools.pyscript.interfaces import IPythonScript, IScriptContainer
@ -42,9 +42,10 @@ def compile(text, filename, mode):
return gen.getCode() return gen.getCode()
class RExpression(RestrictedPython.RCompile.RestrictedCompileMode): #class RExpression(RestrictedPython.RCompile.RestrictedCompileMode):
class RExpression(object):
CodeGeneratorClass = compiler.pycodegen.ExpressionCodeGenerator #CodeGeneratorClass = compiler.pycodegen.ExpressionCodeGenerator
def __init__(self, source, filename, mode="eval"): def __init__(self, source, filename, mode="eval"):
self.mode = mode self.mode = mode
@ -53,7 +54,8 @@ class RExpression(RestrictedPython.RCompile.RestrictedCompileMode):
self.rm = RestrictionMutator() self.rm = RestrictionMutator()
class RestrictionMutator(BaseRM): #class RestrictionMutator(BaseRM):
class RestrictionMutator(object):
unrestricted_objects = unrestricted_objects unrestricted_objects = unrestricted_objects

View file

@ -177,6 +177,8 @@ class RelationRegistry(Catalog):
results = self.apply(criteria) results = self.apply(criteria)
return ResultSet(results, intids) return ResultSet(results, intids)
RelationsRegistry = RelationRegistry
class IIndexableRelation(Interface): class IIndexableRelation(Interface):
""" Provides the attributes needed for indexing relation objects in """ Provides the attributes needed for indexing relation objects in

View file

@ -19,7 +19,7 @@ class Test(unittest.TestCase):
def test_suite(): def test_suite():
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
return unittest.TestSuite(( return unittest.TestSuite((
unittest.makeSuite(Test), unittest.TestLoader().loadTestsFromTestCase(Test),
#doctest.DocTestSuite(cybertools.util.property, optionflags=flags), #doctest.DocTestSuite(cybertools.util.property, optionflags=flags),
doctest.DocFileSuite('adapter.txt', optionflags=flags), doctest.DocFileSuite('adapter.txt', optionflags=flags),
#doctest.DocFileSuite('aop.txt', optionflags=flags), #doctest.DocFileSuite('aop.txt', optionflags=flags),