Warming up: Make acquisition wrappers have __parent__ in addition to aq_parent

(they point to the same thing).
parent f89acd0f
...@@ -419,8 +419,18 @@ Wrapper_findattr(Wrapper *self, PyObject *oname, ...@@ -419,8 +419,18 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
char *name=""; char *name="";
if (PyString_Check(oname)) name=PyString_AS_STRING(oname); if (PyString_Check(oname)) name=PyString_AS_STRING(oname);
if (*name=='a' && name[1]=='q' && name[2]=='_')
if ((r=Wrapper_special(self, name+3, oname))) /* handle aq_ and __parent__ attributes */
if ((*name=='a' && name[1]=='q' && name[2]=='_') ||
(strcmp(name, "__parent__")==0)) {
/* __parent__ is an alias to aq_parent */
if (strcmp(name, "__parent__")==0)
name = "parent";
else
name = name + 3;
if ((r=Wrapper_special(self, name, oname)))
{ {
if (filter) if (filter)
switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig)) switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig))
...@@ -431,6 +441,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname, ...@@ -431,6 +441,7 @@ Wrapper_findattr(Wrapper *self, PyObject *oname,
else return r; else return r;
} }
else PyErr_Clear(); else PyErr_Clear();
}
else if (*name=='_' && name[1]=='_' && else if (*name=='_' && name[1]=='_' &&
(strcmp(name+2,"reduce__")==0 || (strcmp(name+2,"reduce__")==0 ||
strcmp(name+2,"reduce_ex__")==0 || strcmp(name+2,"reduce_ex__")==0 ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment