def __validate(self, obj, index):
        # for list or tuple
        if type(obj) in (list, tuple):
            if len(obj) == 2:
                if (not obj[0] and not obj[1]) or \
                        not isinstance(obj[0], six.string_types) and \
                        not isinstance(obj[1], six.string_types):
                    raise BreadcrumbsInvalidFormat(u"Invalid format for \
                        breadcrumb %s in %s" % (index, type(obj).__name__))
            if len(obj) != 2:
                raise BreadcrumbsInvalidFormat(
                    u"Wrong itens number in breadcrumb %s in %s. \
                    You need to send as example (name,url)" % \
                    (index, type(obj).__name__)
                )
        # for objects and dicts
        else:
            if isinstance(obj, dict) and obj.get('name') and obj.get('url'):
                obj = Breadcrumb(obj['name'], obj['url'])
            if not hasattr(obj, 'name') and not hasattr(obj, 'url'):
                raise BreadcrumbsInvalidFormat(u"You need to use a tuple like "
                    "(name, url) or dict or one object with name and url "
                    "attributes for breadcrumb.")
        return True
Do all on-demand work immediately (useful for debugging).
dataset/ETHPy150Open chronossc/django-breadcrumbs/breadcrumbs/breadcrumbs.py/Breadcrumbs.__validate--crossover with--dataset/ETHPy150Open adampresley/bottlepy-bootstrap/app/bottle.py/Route.prepare