Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d

Resolves a dotted attribute name to an object.  Raises
an AttributeError if any attribute in the chain starts with a '_'.

If the optional allow_dotted_names argument is false, dots are not
supported and this function operates similar to getattr(obj, attr).

        def resolve_dotted_attribute(obj, attr, allow_dotted_names=True):
    """resolve_dotted_attribute(a, 'b.c.d') => a.b.c.d

    Resolves a dotted attribute name to an object.  Raises
    an AttributeError if any attribute in the chain starts with a '_'.

    If the optional allow_dotted_names argument is false, dots are not
    supported and this function operates similar to getattr(obj, attr).
    """

    if allow_dotted_names:
        attrs = attr.split('.')
    else:
        attrs = [attr]

    for i in attrs:
        if i.startswith('_'):
            raise AttributeError(
                'attempt to access private attribute "%s"' % i
                )
        else:
            obj = getattr(obj,i)
    return obj
        


src/e/p/epc-0.0.5/epc/core.py   epc(Download)
            except AttributeError:
                return SimpleXMLRPCServer.resolve_dotted_attribute(
                    self.instance, name, self.allow_dotted_names)
 
 

src/p/y/python-epc-HEAD/epc/core.py   python-epc(Download)
            except AttributeError:
                return SimpleXMLRPCServer.resolve_dotted_attribute(
                    self.instance, name, self.allow_dotted_names)