Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
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
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitry Blinov
slapos
Commits
488f45fe
Commit
488f45fe
authored
Aug 16, 2019
by
Bryton Lacquement
🚪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version up: Acquisition 4.5+SlapOSPatched001
parent
17d8fe38
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
77 deletions
+78
-77
component/egg-patch/Acquisition/aq_dynamic.patch
component/egg-patch/Acquisition/aq_dynamic.patch
+76
-75
stack/erp5/buildout.cfg
stack/erp5/buildout.cfg
+2
-2
No files found.
component/egg-patch/Acquisition/aq_dynamic.patch
View file @
488f45fe
diff -uNr Acquisition-
2.13.12.orig/src/Acquisition/_Acquisition.c Acquisition-2.13.12
/src/Acquisition/_Acquisition.c
diff -uNr Acquisition-
4.5.orig/src/Acquisition/_Acquisition.c Acquisition-4.5
/src/Acquisition/_Acquisition.c
--- Acquisition-
2.13.12.orig/src/Acquisition/_Acquisition.c 2017-12-01 12:01:34.000000000
+0100
--- Acquisition-
4.5.orig/src/Acquisition/_Acquisition.c 2018-12-10 14:50:38.607014475
+0100
+++ Acquisition-
2.13.12/src/Acquisition/_Acquisition.c 2018-04-09 17:10:15.394836944 +02
00
+++ Acquisition-
4.5/src/Acquisition/_Acquisition.c 2018-12-10 15:11:31.902452836 +01
00
@@ -
449,6 +449
,64 @@
@@ -
541,6 +541
,64 @@
}
}
static PyObject *
static PyObject *
...
@@ -17,42 +17,42 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/_Acquisition.c Acquisition-2.
...
@@ -17,42 +17,42 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/_Acquisition.c Acquisition-2.
+ PyObject *d, *m;
+ PyObject *d, *m;
+ PyObject *o;
+ PyObject *o;
+
+
+ if (isWrapper
(self))
+ if (isWrapper(self))
+ o = WRAPPER(self)->obj;
+ o = WRAPPER(self)->obj;
+ else
+ else
+ o = self;
+ o = self;
+
+
+ /* Try to get an attribute in the normal way first. */
+ /* Try to get an attribute in the normal way first. */
+ r = PyObject_GetAttr(o, attr_name);
+ r = PyObject_GetAttr(o, attr_name);
+ if (r)
+ if (r)
+ return r;
+ return r;
+
+
+ /* If an unexpected error happens, return immediately. */
+ /* If an unexpected error happens, return immediately. */
+ PyErr_Fetch(&r,
&v,
&tb);
+ PyErr_Fetch(&r,
&v,
&tb);
+ if (r != PyExc_AttributeError)
+ if (r != PyExc_AttributeError)
+ {
+ {
+ PyErr_Restore(r,
v,
tb);
+ PyErr_Restore(r,
v,
tb);
+ return NULL;
+ return NULL;
+ }
+ }
+
+
+ /* Try to get _aq_dynamic. */
+ /* Try to get _aq_dynamic. */
+ m = PyObject_GetAttrString(o, "_aq_dynamic");
+ m = PyObject_GetAttrString(o, "_aq_dynamic");
+ if (!
m) {
+ if (!m) {
+ PyErr_Restore(r,
v,
tb);
+ PyErr_Restore(r,
v,
tb);
+ return NULL;
+ return NULL;
+ }
+ }
+
+
+ /* Call _aq_dynamic in the context of the original acquisition wrapper. */
+ /* Call _aq_dynamic in the context of the original acquisition wrapper. */
+ if (PyECMethod_Check(m) && PyECMethod_Self(m)
==
o)
+ if (PyECMethod_Check(m) && PyECMethod_Self(m)
==
o)
+ ASSIGN(m,
PyECMethod_New(m,
OBJECT(self)));
+ ASSIGN(m,
PyECMethod_New(m,
OBJECT(self)));
+ else if (has__of__(m)) ASSIGN(m,__of__(m,OBJECT(self)));
+ else if (has__of__(m)) ASSIGN(m,
__of__(m,OBJECT(self)));
+ d = PyObject_CallFunction(m, "O", attr_name);
+ d = PyObject_CallFunction(m, "O", attr_name);
+ Py_DECREF(m);
+ Py_DECREF(m);
+
+
+ /* In the case of None, assume that the attribute is not found. */
+ /* In the case of None, assume that the attribute is not found. */
+ if (d == Py_None) {
+ if (d == Py_None) {
+ Py_DECREF(d);
+ Py_DECREF(d);
+ PyErr_Restore(r,
v,
tb);
+ PyErr_Restore(r,
v,
tb);
+ return NULL;
+ return NULL;
+ }
+ }
+
+
...
@@ -63,51 +63,51 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/_Acquisition.c Acquisition-2.
...
@@ -63,51 +63,51 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/_Acquisition.c Acquisition-2.
+}
+}
+
+
+static PyObject *
+static PyObject *
Wrapper_acquire(Wrapper *self, PyObject *oname,
Wrapper_acquire(Wrapper *self, PyObject *oname,
PyObject *filter, PyObject *extra, PyObject *orig,
PyObject *filter, PyObject *extra, PyObject *orig,
int explicit, int containment);
int explicit, int containment);
@@ -
589,8 +647
,8 @@
@@ -
675,8 +733
,8 @@
Py_XDECREF(r); Py_XDECREF(v); Py_XDECREF(tb)
;
return NULL
;
r=NULL;
}
}
-
/* normal attribute lookup */
-
/* normal attribute lookup */
-
else if ((r=PyObject_GetAttr(self->obj,oname)))
-
else if ((r = PyObject_GetAttr(self->obj, oname))) {
+ /* Give _aq_dynamic a chance, then normal attribute lookup */
+
/* Give _aq_dynamic a chance, then normal attribute lookup */
+
else if ((r=Wrapper_GetAttr(OBJECT(self),oname,orig)))
+
else if ((r = Wrapper_GetAttr(OBJECT(self), oname, orig))) {
{
if (r == Acquired)
{
if (r==Acquired)
Py_DECREF(r);
{
return Wrapper_acquire(
@@ -
714,7 +77
2,7 @@
@@ -
804,7 +86
2,7 @@
Py_XDECREF(r); Py_XDECREF(v); Py_XDECREF(tb)
;
return NULL
;
r=NULL;
}
- if ((r=PyObject_GetAttr(self->container,oname))) {
- if ((r = PyObject_GetAttr(self->container, oname)) == NULL) {
+ if ((r=Wrapper_GetAttr(self->container,oname,orig))) {
+ if ((r = Wrapper_GetAttr(self->container, oname, orig)) == NULL) {
if (r == Acquired) {
/* May be AttributeError or some other kind of error */
Py_DECREF(r);
return NULL;
}
}
@@ -751,7 +809,7 @@
@@ -828,7 +886,7 @@
static PyObject *
Wrapper_getattro(Wrapper *self, PyObject *oname)
Wrapper_getattro(Wrapper *self, PyObject *oname)
{
{
if (self->obj || self->container)
- return Wrapper_findattr(self, oname, NULL, NULL, NULL, 1, 1, 0, 0);
- return Wrapper_findattr(self, oname, NULL, NULL, NULL, 1, 1, 0, 0);
+ return Wrapper_findattr(self, oname, NULL, NULL, OBJECT(self), 1, 1, 0, 0);
+ return Wrapper_findattr(self, oname, NULL, NULL, OBJECT(self), 1, 1, 0, 0);
}
/* Maybe we are getting initialized? */
static PyObject *
return Py_FindAttr(OBJECT(self),oname);
@@ -844,7 +902,7 @@
@@ -776,7 +834,7 @@
if (STR_EQ(PyBytes_AS_STRING(tmp), "acquire")) {
result = Py_FindAttr(OBJECT(self),
oname);
result = Py_FindAttr(OBJECT(self),
oname);
} else {
else if (self->obj || self->container)
- result = Wrapper_findattr(self, oname, NULL, NULL, NULL, 1, 0, 0, 0);
- result = Wrapper_findattr(self, oname, NULL, NULL, NULL
, 1, 0, 0, 0);
+ result = Wrapper_findattr(self, oname, NULL, NULL, OBJECT(self)
, 1, 0, 0, 0);
+ result = Wrapper_findattr(self, oname, NULL, NULL, OBJECT(self), 1, 0, 0, 0);
}
/* Maybe we are getting initialized? */
Py_DECREF(tmp);
else result = Py_FindAttr(OBJECT(self),oname);
diff -uNr Acquisition-4.5.orig/src/Acquisition/test_dynamic_acquisition.py Acquisition-4.5/src/Acquisition/test_dynamic_acquisition.py
diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py Acquisition-2.13.12/src/Acquisition/test_dynamic_acquisition.py
--- Acquisition-4.5.orig/src/Acquisition/test_dynamic_acquisition.py 1970-01-01 01:00:00.000000000 +0100
--- Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py 1970-01-01 01:00:00.000000000 +0100
+++ Acquisition-4.5/src/Acquisition/test_dynamic_acquisition.py 2018-12-10 14:45:01.601164033 +0100
+++ Acquisition-2.13.12/src/Acquisition/test_dynamic_acquisition.py 2018-04-09 17:07:34.863985305 +0200
@@ -0,0 +1,161 @@
@@ -0,0 +1,160 @@
+##############################################################################
+##############################################################################
+#
+#
+# Copyright (c) 1996-2002 Zope Corporation and Contributors.
+# Copyright (c) 1996-2002 Zope Corporation and Contributors.
...
@@ -121,6 +121,8 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
...
@@ -121,6 +121,8 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
+# FOR A PARTICULAR PURPOSE
+# FOR A PARTICULAR PURPOSE
+#
+#
+##############################################################################
+##############################################################################
+from __future__ import print_function
+
+import Acquisition
+import Acquisition
+
+
+def checkContext(self, o):
+def checkContext(self, o):
...
@@ -148,8 +150,8 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
...
@@ -148,8 +150,8 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
+
+
+ def dynmethod():
+ def dynmethod():
+ chain = ' <- '.join(repr(obj) for obj in Acquisition.aq_chain(self))
+ chain = ' <- '.join(repr(obj) for obj in Acquisition.aq_chain(self))
+ print
repr(self) + '.' + attr
+ print
(repr(self) + '.' + attr)
+ print
'chain:', chain
+ print
('chain:', chain)
+
+
+ return dynmethod
+ return dynmethod
+
+
...
@@ -162,7 +164,7 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
...
@@ -162,7 +164,7 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
+ self.name = name
+ self.name = name
+
+
+ def hi(self):
+ def hi(self):
+ print
self, self.color
+ print
(self, self.color)
+
+
+ def _aq_dynamic(self, attr):
+ def _aq_dynamic(self, attr):
+ return None
+ return None
...
@@ -174,7 +176,7 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
...
@@ -174,7 +176,7 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
+ r'''
+ r'''
+ The _aq_dynamic functionality allows an object to dynamically provide an
+ The _aq_dynamic functionality allows an object to dynamically provide an
+ attribute.
+ attribute.
+
+
+ If an object doesn't have an attribute, Acquisition checks to see if the
+ If an object doesn't have an attribute, Acquisition checks to see if the
+ object has a _aq_dynamic method, which is then called. It is functionally
+ object has a _aq_dynamic method, which is then called. It is functionally
+ equivalent to __getattr__, but _aq_dynamic is called with 'self' as the
+ equivalent to __getattr__, but _aq_dynamic is called with 'self' as the
...
@@ -189,11 +191,11 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
...
@@ -189,11 +191,11 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
+ >>> A().hi()
+ >>> A().hi()
+ Traceback (most recent call last):
+ Traceback (most recent call last):
+ ...
+ ...
+ AttributeError:
color
+ AttributeError:
...
+
+
+ The class B, on the other hand, generates all attributes dynamically,
+ The class B, on the other hand, generates all attributes dynamically,
+ except if it is called 'bonjour'.
+ except if it is called 'bonjour'.
+
+
+ First we need to check that, even if an object provides '_aq_dynamic',
+ First we need to check that, even if an object provides '_aq_dynamic',
+ "regular" Aquisition attribute access should still work:
+ "regular" Aquisition attribute access should still work:
+
+
...
@@ -222,12 +224,12 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
...
@@ -222,12 +224,12 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
+ >>> b.a.bonjour()
+ >>> b.a.bonjour()
+ Traceback (most recent call last):
+ Traceback (most recent call last):
+ ...
+ ...
+ AttributeError:
bonjour
+ AttributeError:
...
+
+
+ >>> a.b.bonjour()
+ >>> a.b.bonjour()
+ Traceback (most recent call last):
+ Traceback (most recent call last):
+ ...
+ ...
+ AttributeError:
bonjour
+ AttributeError:
...
+
+
+ '''
+ '''
+
+
...
@@ -267,22 +269,21 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
...
@@ -267,22 +269,21 @@ diff -uNr Acquisition-2.13.12.orig/src/Acquisition/test_dynamic_acquisition.py A
+ >>> assert not b.c.aq_inContextOf(b.a)
+ >>> assert not b.c.aq_inContextOf(b.a)
+ >>> assert not b.a.aq_inContextOf('somestring')
+ >>> assert not b.a.aq_inContextOf('somestring')
+'''
+'''
+
diff -uNr Acquisition-4.5.orig/src/Acquisition/tests.py Acquisition-4.5/src/Acquisition/tests.py
diff -uNr Acquisition-2.13.12.orig/src/Acquisition/tests.py Acquisition-2.13.12/src/Acquisition/tests.py
--- Acquisition-4.5.orig/src/Acquisition/tests.py 2018-12-10 14:50:38.607014475 +0100
--- Acquisition-2.13.12.orig/src/Acquisition/tests.py 2017-12-01 12:01:34.000000000 +0100
+++ Acquisition-4.5/src/Acquisition/tests.py 2018-12-10 15:11:31.902452836 +0100
+++ Acquisition-2.13.12/src/Acquisition/tests.py 2018-04-09 17:07:34.867985476 +0200
@@ -3338,6 +3338,7 @@
@@ -2588,6 +2588,7 @@
def test_suite():
suites = [
return unittest.TestSuite((
DocTestSuite(),
DocTestSuite(),
+ DocTestSuite('Acquisition.test_dynamic_acquisition'),
+ DocTestSuite('Acquisition.test_dynamic_acquisition'),
DocFileSuite('README.txt', package='Acquisition'
),
unittest.defaultTestLoader.loadTestsFromName(__name__
),
unittest.makeSuite(TestParent),
]
unittest.makeSuite(TestAcquire),
diff -uNr Acquisition-
2.13.12.orig/src/Acquisition.egg-info/SOURCES.txt Acquisition-2.13.12
/src/Acquisition.egg-info/SOURCES.txt
diff -uNr Acquisition-
4.5.orig/src/Acquisition.egg-info/SOURCES.txt Acquisition-4.5
/src/Acquisition.egg-info/SOURCES.txt
--- Acquisition-
2.13.12.orig/src/Acquisition.egg-info/SOURCES.txt 2017-12-01 12:08:29.0000000
00 +0100
--- Acquisition-
4.5.orig/src/Acquisition.egg-info/SOURCES.txt 2018-12-10 14:52:53.4725548
00 +0100
+++ Acquisition-
2.13.12/src/Acquisition.egg-info/SOURCES.txt 2018-04-09 17:07:34.867985476 +02
00
+++ Acquisition-
4.5/src/Acquisition.egg-info/SOURCES.txt 2018-12-10 15:02:54.257219665 +01
00
@@ -1
0,6 +10
,7 @@
@@ -1
4,6 +14
,7 @@
src/Acquisition/_Acquisition.c
src/Acquisition/_Acquisition.c
src/Acquisition/__init__.py
src/Acquisition/__init__.py
src/Acquisition/interfaces.py
src/Acquisition/interfaces.py
...
...
stack/erp5/buildout.cfg
View file @
488f45fe
...
@@ -531,7 +531,7 @@ extra-paths =
...
@@ -531,7 +531,7 @@ extra-paths =
# patches for eggs
# patches for eggs
patch-binary = ${patch:location}/bin/patch
patch-binary = ${patch:location}/bin/patch
Acquisition-patches = ${:_profile_base_location_}/../../component/egg-patch/Acquisition/aq_dynamic.patch#
1d9a56e9af4371f5b6951ebf217a15d
7
Acquisition-patches = ${:_profile_base_location_}/../../component/egg-patch/Acquisition/aq_dynamic.patch#
e923ab436d53282df536de3ef7d3e12
7
Acquisition-patch-options = -p1
Acquisition-patch-options = -p1
Products.DCWorkflow-patches = ${:_profile_base_location_}/../../component/egg-patch/Products.DCWorkflow/workflow_method.patch#975b49e96bae33ac8563454fe5fa9899
Products.DCWorkflow-patches = ${:_profile_base_location_}/../../component/egg-patch/Products.DCWorkflow/workflow_method.patch#975b49e96bae33ac8563454fe5fa9899
Products.DCWorkflow-patch-options = -p1
Products.DCWorkflow-patch-options = -p1
...
@@ -574,7 +574,7 @@ scripts +=
...
@@ -574,7 +574,7 @@ scripts +=
# neoppod, mysqlclient, slapos.recipe.template & [slapos-deps-eggs]
# neoppod, mysqlclient, slapos.recipe.template & [slapos-deps-eggs]
# patched eggs
# patched eggs
Acquisition =
2.13.12
+SlapOSPatched001
Acquisition =
4.5
+SlapOSPatched001
Products.DCWorkflow = 2.2.4+SlapOSPatched001
Products.DCWorkflow = 2.2.4+SlapOSPatched001
ocropy = 1.0+SlapOSPatched001
ocropy = 1.0+SlapOSPatched001
pysvn = 1.7.10+SlapOSPatched002
pysvn = 1.7.10+SlapOSPatched002
...
...
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