~openerp-dev/openobject-server/trunk-staging-mat

« back to all changes in this revision

Viewing changes to openerp/tools/func.py

[MERGE] Web assets moved from manifests to ir.ui.view bundles

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    """
35
35
    def __init__(self, fget):
36
36
        self.fget = fget
37
 
        self.name = fget.__name__
38
37
 
39
38
    def __get__(self, obj, cls):
40
39
        if obj is None:
41
40
            return self
42
41
        value = self.fget(obj)
43
 
        setattr(obj, self.name, value)
 
42
        setattr(obj, self.fget.__name__, value)
44
43
        return value
45
44
 
46
45
    @staticmethod
47
46
    def reset_all(obj):
48
47
        """ Reset all lazy properties on the instance `obj`. """
49
48
        cls = type(obj)
50
 
        obj_dict = obj.__dict__
 
49
        obj_dict = vars(obj)
51
50
        for name in obj_dict.keys():
52
51
            if isinstance(getattr(cls, name, None), lazy_property):
53
52
                obj_dict.pop(name)