formations/python/formation/snippets/wrap.py

23 lines
583 B
Python
Raw Normal View History

2013-01-08 11:15:45 +01:00
class Wrap(object):
def __init__(self, name, wrap):
2013-05-15 10:47:55 +02:00
self.slots = ('_name', '_w')
2013-01-08 11:15:45 +01:00
self._name = name or "wrapped_element"
self._w = wrap
def __getattr__(self, name):
if name in self.slots:
return getattr(self, name)
else:
return getattr(self._w, name)
# def get_w(self, name):
# return getattr(self._w, name)
# def set_w(self, name, value):
# return setattr(self._w, name, value)
# _w = property (get_w, set_w)
def __repr__(self):
return "[W_Element %s]"% repr(self._name)