From 814d7c07625e1f9e97862d4b11aafc95389dfd4b Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Wed, 2 Oct 2024 09:08:16 +0200 Subject: [PATCH] changes to allow zodbupdate to migrate old data --- cybertools/pyscript/script.py | 22 ++++++++++++---------- cybertools/relation/registry.py | 2 ++ cybertools/util/tests.py | 2 +- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/cybertools/pyscript/script.py b/cybertools/pyscript/script.py index 72c4b87..46cfe9e 100644 --- a/cybertools/pyscript/script.py +++ b/cybertools/pyscript/script.py @@ -4,17 +4,17 @@ """ import os, re -import compiler.pycodegen +#import compiler.pycodegen from io import StringIO from persistent import Persistent -import RestrictedPython.RCompile -from RestrictedPython.SelectCompiler import ast -from zope.app.container.btree import BTreeContainer -from zope.app.container.contained import Contained +#import RestrictedPython.RCompile +#from RestrictedPython.SelectCompiler import ast +from zope.container.btree import BTreeContainer +from zope.container.contained import Contained from zope.interface import implementer from zope.proxy import removeAllProxies -from zope.security.untrustedpython.builtins import SafeBuiltins -from zope.security.untrustedpython.rcompile import RestrictionMutator as BaseRM +#from zope.security.untrustedpython.builtins import SafeBuiltins +#from zope.security.untrustedpython.rcompile import RestrictionMutator as BaseRM from zope.traversing.api import getParent, getPath from cybertools.pyscript.interfaces import IPythonScript, IScriptContainer @@ -42,9 +42,10 @@ def compile(text, filename, mode): 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"): self.mode = mode @@ -53,7 +54,8 @@ class RExpression(RestrictedPython.RCompile.RestrictedCompileMode): self.rm = RestrictionMutator() -class RestrictionMutator(BaseRM): +#class RestrictionMutator(BaseRM): +class RestrictionMutator(object): unrestricted_objects = unrestricted_objects diff --git a/cybertools/relation/registry.py b/cybertools/relation/registry.py index 8092c04..7ba62e1 100644 --- a/cybertools/relation/registry.py +++ b/cybertools/relation/registry.py @@ -177,6 +177,8 @@ class RelationRegistry(Catalog): results = self.apply(criteria) return ResultSet(results, intids) +RelationsRegistry = RelationRegistry + class IIndexableRelation(Interface): """ Provides the attributes needed for indexing relation objects in diff --git a/cybertools/util/tests.py b/cybertools/util/tests.py index 699ac33..59fcf24 100755 --- a/cybertools/util/tests.py +++ b/cybertools/util/tests.py @@ -19,7 +19,7 @@ class Test(unittest.TestCase): def test_suite(): flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS return unittest.TestSuite(( - unittest.makeSuite(Test), + unittest.TestLoader().loadTestsFromTestCase(Test), #doctest.DocTestSuite(cybertools.util.property, optionflags=flags), doctest.DocFileSuite('adapter.txt', optionflags=flags), #doctest.DocFileSuite('aop.txt', optionflags=flags),