def __getattr__(self, name):
if name.startswith('_'):
# Here first I try to get the _attribute from
# from the delegate obj.
try:
ret = getattr(self.delegate, name)
except AttributeError:
raise AttributeError(
"%s has no attribute %r. To access the %s"
" collection, use collection['%s']." % (
self.__class__.__name__, name, name,
name))
return ret
return self[name]
评论列表
文章目录