[Zope-Checkins]
SVN: Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/
Warming up: Make acquisition wrappers have __parent__ in
addition to aq_parent
Philipp von Weitershausen
philikon at philikon.de
Mon Nov 20 19:28:33 EST 2006
Log message for revision 71220:
Warming up: Make acquisition wrappers have __parent__ in addition to aq_parent
(they point to the same thing).
Changed:
_U Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/
U Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/_Acquisition.c
-=-
Property changes on: Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition
___________________________________________________________________
Name: svk:merge
- bfa16f6a-5b7b-4684-983a-15b8a78f95a3:/local/Acquisition:3235
+ bfa16f6a-5b7b-4684-983a-15b8a78f95a3:/local/Acquisition:3236
Modified: Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/_Acquisition.c
===================================================================
--- Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/_Acquisition.c 2006-11-21 00:28:19 UTC (rev 71219)
+++ Zope/branches/philikon-aq-and-__parent__/lib/python/Acquisition/_Acquisition.c 2006-11-21 00:28:33 UTC (rev 71220)
@@ -419,8 +419,18 @@
char *name="";
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)
switch(apply_filter(filter,OBJECT(self),oname,r,extra,orig))
@@ -431,6 +441,7 @@
else return r;
}
else PyErr_Clear();
+ }
else if (*name=='_' && name[1]=='_' &&
(strcmp(name+2,"reduce__")==0 ||
strcmp(name+2,"reduce_ex__")==0 ||
More information about the Zope-Checkins
mailing list