Deleted Added
sdiff udiff text old ( 9280:fda147c035b3 ) new ( 10195:7d4d0cd3f7e5 )
full compact
1# Copyright (c) 2004-2006 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

--- 68 unchanged lines hidden (view full) ---

77 def unproxy(self, base):
78 obj = base
79 done = False
80
81 if self._search_self:
82 result, done = self.find(obj)
83
84 if self._search_up:
85 while not done:
86 obj = obj._parent
87 if not obj:
88 break
89 result, done = self.find(obj)
90
91 if not done:
92 raise AttributeError, \
93 "Can't resolve proxy '%s' of type '%s' from '%s'" % \
94 (self.path(), self._pdesc.ptype_str, base.path())
95
96 if isinstance(result, BaseProxy):
97 if result == self:
98 raise RuntimeError, "Cycle in unproxy"

--- 47 unchanged lines hidden (view full) ---

146 raise AttributeError, "Index operation on bound proxy"
147 new_self = copy.deepcopy(self)
148 new_self._modifiers.append(key)
149 return new_self
150
151 def find(self, obj):
152 try:
153 val = getattr(obj, self._attr)
154 # for any additional unproxying to be done, pass the
155 # current, rather than the original object so that proxy
156 # has the right context
157 obj = val
158 except:
159 return None, False
160 while isproxy(val):
161 val = val.unproxy(obj)
162 for m in self._modifiers:
163 if isinstance(m, str):
164 val = getattr(val, m)
165 elif isinstance(m, int):

--- 67 unchanged lines hidden ---