Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
c5ba0b5e
Commit
c5ba0b5e
authored
Mar 12, 2001
by
Shane Hathaway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed aq_inContextOf().
parent
dbefa2df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
26 deletions
+28
-26
lib/Components/ExtensionClass/src/Acquisition.c
lib/Components/ExtensionClass/src/Acquisition.c
+28
-26
No files found.
lib/Components/ExtensionClass/src/Acquisition.c
View file @
c5ba0b5e
...
...
@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
$Id: Acquisition.c,v 1.4
7 2001/02/19 19:16:07 jeremy
Exp $
$Id: Acquisition.c,v 1.4
8 2001/03/12 16:36:46 shane
Exp $
If you have questions regarding this software,
contact:
...
...
@@ -1050,38 +1050,40 @@ Wrapper_acquire_method(Wrapper *self, PyObject *args, PyObject *kw)
static
PyObject
*
Wrapper_inContextOf
(
Wrapper
*
self
,
PyObject
*
args
)
{
PyObject
*
o
,
*
c
,
*
bc
;
int
inner
=
0
;
PyObject
*
o
,
*
c
;
int
inner
=
1
;
UNLESS
(
PyArg_ParseTuple
(
args
,
"O|i"
,
&
o
,
&
inner
))
return
NULL
;
if
(
inner
)
while
(
self
->
obj
&&
isWrapper
(
self
->
obj
))
self
=
WRAPPER
(
self
->
obj
);
c
=
OBJECT
(
self
);
while
(
1
)
{
if
(
c
==
o
)
return
PyInt_FromLong
(
1
);
if
(
c
&&
isWrapper
(
c
))
c
=
WRAPPER
(
c
)
->
container
;
else
break
;
}
if
(
inner
)
{
/* o = aq_base(o) */
while
(
isWrapper
(
o
)
&&
WRAPPER
(
o
)
->
obj
)
o
=
WRAPPER
(
o
)
->
obj
;
/* Now try harder: Compare each object in the containment chain that
starts at self, with the object of the wrapper passed in to this
method. If a match is found, return 1. Thanks to Toby Dickenson.*/
/* while 1: */
while
(
1
)
{
while
(
isWrapper
(
o
)
&&
WRAPPER
(
o
)
->
obj
)
o
=
WRAPPER
(
o
)
->
obj
;
/* if aq_base(self) is o: return 1 */
c
=
self
->
obj
;
while
(
isWrapper
(
c
)
&&
WRAPPER
(
c
)
->
obj
)
c
=
WRAPPER
(
c
)
->
obj
;
if
(
c
==
o
)
return
PyInt_FromLong
(
1
);
c
=
OBJECT
(
self
);
while
(
1
)
{
bc
=
c
;
while
(
isWrapper
(
bc
)
&&
WRAPPER
(
bc
)
->
obj
)
bc
=
WRAPPER
(
bc
)
->
obj
;
if
(
bc
==
o
)
return
PyInt_FromLong
(
1
);
/* self = aq_parent(aq_inner(self)) */
/* if self is None: break */
while
(
self
->
obj
&&
isWrapper
(
self
->
obj
))
self
=
WRAPPER
(
self
->
obj
);
if
(
self
->
container
&&
isWrapper
(
self
->
container
))
self
=
WRAPPER
(
self
->
container
);
else
break
;
}
}
else
{
/* Follow wrappers instead. */
c
=
OBJECT
(
self
);
while
(
1
)
{
if
(
c
==
o
)
return
PyInt_FromLong
(
1
);
if
(
c
&&
isWrapper
(
c
))
c
=
WRAPPER
(
c
)
->
container
;
else
break
;
}
}
return
PyInt_FromLong
(
0
);
}
...
...
@@ -1425,7 +1427,7 @@ void
initAcquisition
()
{
PyObject
*
m
,
*
d
;
char
*
rev
=
"$Revision: 1.4
7
$"
;
char
*
rev
=
"$Revision: 1.4
8
$"
;
PURE_MIXIN_CLASS
(
Acquirer
,
"Base class for objects that implicitly"
" acquire attributes from containers
\n
"
...
...
@@ -1444,7 +1446,7 @@ initAcquisition()
/* Create the module and add the functions */
m
=
Py_InitModule4
(
"Acquisition"
,
methods
,
"Provide base classes for acquiring objects
\n\n
"
"$Id: Acquisition.c,v 1.4
7 2001/02/19 19:16:07 jeremy
Exp $
\n
"
,
"$Id: Acquisition.c,v 1.4
8 2001/03/12 16:36:46 shane
Exp $
\n
"
,
OBJECT
(
NULL
),
PYTHON_API_VERSION
);
d
=
PyModule_GetDict
(
m
);
...
...
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