Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
5
Merge Requests
5
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
slapos
Commits
ccba981c
Commit
ccba981c
authored
Sep 19, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stack/erp5: backport some Zope fixes WIP
parent
5b67ccce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
1 deletion
+76
-1
component/egg-patch/Zope/0002-mapply-wip.patch
component/egg-patch/Zope/0002-mapply-wip.patch
+74
-0
stack/erp5/buildout.cfg
stack/erp5/buildout.cfg
+2
-1
No files found.
component/egg-patch/Zope/0002-mapply-wip.patch
0 → 100644
View file @
ccba981c
From d439b58562670886b3247829aa9ff053b6aaf7fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 19 Sep 2023 06:28:54 +0200
Subject: [PATCH 2/2] mapply wip
---
src/ZPublisher/mapply.py | 5 ++++-
src/ZPublisher/tests/test_mapply.py | 21 ++++++++++++++++++---
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/src/ZPublisher/mapply.py b/src/ZPublisher/mapply.py
index 19deeacf4..41c9ed7e1 100644
--- a/src/ZPublisher/mapply.py
+++ b/src/ZPublisher/mapply.py
@@ -21,7 +21,7 @@
def default_call_object(object, args, context):
def default_missing_name(name, context):
- raise TypeError('argument %s was ommitted' % name)
+ raise TypeError('argument %s was omitted' % name)
def default_handle_class(klass, context):
@@ -61,6 +61,9 @@
def mapply(object, positional=(), keyword={},
positional.insert(0, missing_name('self', context))
if len(positional) > nargs:
raise TypeError('too many arguments')
+ for a, name in zip(positional, names):
+ if name in keyword:
+ raise TypeError('multiple values for argument %s' % name)
args = positional
else:
if bind and nargs and names[0] == 'self':
diff --git a/src/ZPublisher/tests/test_mapply.py b/src/ZPublisher/tests/test_mapply.py
index d31f6d61b..d08a5c979 100644
--- a/src/ZPublisher/tests/test_mapply.py
+++ b/src/ZPublisher/tests/test_mapply.py
@@ -28,11 +28,10 @@
class MapplyTests(unittest.TestCase):
def compute(a, b, c=4):
return '%d%d%d' % (a, b, c)
- values = {'a': 2, 'b': 3, 'c': 5}
- v = mapply(compute, (), values)
+ v = mapply(compute, (), {'a': 2, 'b': 3, 'c': 5})
self.assertEqual(v, '235')
- v = mapply(compute, (7,), values)
+ v = mapply(compute, (7,), {'b': 3, 'c': 5})
self.assertEqual(v, '735')
def testClass(self):
@@ -115,3 +114,19 @@
class MapplyTests(unittest.TestCase):
ob = NoCallButAcquisition().__of__(Root())
self.assertRaises(TypeError, mapply, ob, (), {})
+
+ def testErrors(self):
+ def compute(a, b, c=4):
+ return '%d%d%d' % (a, b, c)
+
+ with self.assertRaisesRegex(TypeError, 'argument a was omitted'):
+ mapply(compute, (), {})
+
+ with self.assertRaisesRegex(TypeError, 'argument b was omitted'):
+ mapply(compute, (1, ), {})
+
+ with self.assertRaisesRegex(TypeError, 'multiple values for argument b'):
+ mapply(compute, (1, 2, ), {'b': 3})
+
+ with self.assertRaisesRegex(TypeError, 'too many arguments'):
+ mapply(compute, (1, 2, 3, 4), {})
--
2.39.2
stack/erp5/buildout.cfg
View file @
ccba981c
...
...
@@ -696,6 +696,7 @@ urlnorm-patches = ${:_profile_base_location_}/../../component/egg-patch/urlnorm/
urlnorm-patch-options = -p1
Zope-patches =
${:_profile_base_location_}/../../component/egg-patch/Zope/0001-WSGIPublisher-set-REMOTE_USER-even-in-case-of-error-.patch#a437f4da28975f94dd07db0b02954111
${:_profile_base_location_}/../../component/egg-patch/Zope/0002-mapply-wip.patch#56928a9d0b25b344feb0b6ead7bc5e48
Zope-patch-options = -p1
[eggs:python2]
...
...
@@ -771,7 +772,7 @@ PyPDF2 = 1.26.0+SlapOSPatched002
pysvn = 1.9.15+SlapOSPatched001
python-ldap = 2.4.32+SlapOSPatched001
python-magic = 0.4.12+SlapOSPatched001
Zope = 4.8.9+SlapOSPatched00
1
Zope = 4.8.9+SlapOSPatched00
2
## https://lab.nexedi.com/nexedi/slapos/merge_requests/648
pylint = 1.4.4+SlapOSPatched002
# astroid 1.4.1 breaks testDynamicClassGeneration
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment