mixcoatl/resource.py
def add_property(self, prop_name):
        """Adds setter, getter and property for field `prop_name`"""
        def set_attribute(cls, val):
            # since we are using __ mangling we need _'+cls.__class__.__name__+
            setattr(cls, '_'+cls.__class__.__name__+'__'+prop_name, val)

        def get_attribute(cls):
            return getattr(cls, '_'+cls.__class__.__name__+'__'+prop_name)

        setattr(self.__class__, 'set_'+prop_name, set_attribute)
        setattr(self.__class__, 'get_'+prop_name, get_attribute)
        setattr(self.__class__,
                prop_name,
                property(
                    getattr(self.__class__, 'get_'+prop_name),
                    getattr(self.__class__, 'set_'+prop_name)
                ))
Adds setter, getter and property for field `prop_name`
Adds setter, getter and property for field `prop_name`
Adds setter getter and property for field ` prop_name `
def add_property(self, prop_name):
        def set_attribute(cls, val):
            setattr(cls, '_'+cls.__class__.__name__+'__'+prop_name, val)
        def get_attribute(cls):
            return getattr(cls, '_'+cls.__class__.__name__+'__'+prop_name)
        setattr(self.__class__, 'set_'+prop_name, set_attribute)
        setattr(self.__class__, 'get_'+prop_name, get_attribute)
        setattr(self.__class__,
                prop_name,
                property(
                    getattr(self.__class__, 'get_'+prop_name),
                    getattr(self.__class__, 'set_'+prop_name)
                ))
def add_property ( self , prop_name ) : def set_attribute ( cls , val ) : setattr ( cls , '_' + cls . __class__ . __name__ + '__' + prop_name , val ) def get_attribute ( cls ) : return getattr ( cls , '_' + cls . __class__ . __name__ + '__' + prop_name ) setattr ( self . __class__ , 'set_' + prop_name , set_attribute ) setattr ( self . __class__ , 'get_' + prop_name , get_attribute ) setattr ( self . __class__ , prop_name , property ( getattr ( self . __class__ , 'get_' + prop_name ) , getattr ( self . __class__ , 'set_' + prop_name ) ) )
Adds setter, getter and property for field `prop_name`
Adds setter getter and property for field ` prop_name `
"""Adds setter, getter and property for field `prop_name`""" # since we are using __ mangling we need _'+cls.__class__.__name__+
self
prop_name