

def __get_dynamic_attr(self, attname, obj, default=None):
    ' Returns first defined occurence of the following: \n                self.$attname(obj)\n                self.$attname()\n                self.$attname\n                default\n            Taken from django.contrib.syndication.views.Feed\n        '
    try:
        attr = getattr(self, attname)
    except AttributeError:
        return default
    if callable(attr):
        if hasattr(attr, 'func_code'):
            argcount = attr.func_code.co_argcount
        else:
            argcount = attr.__call__.func_code.co_argcount
        if (argcount == 2):
            return attr(obj)
        else:
            return attr()
    return attr

dataset/ETHPy150Open statesofpop/django-cal/django_cal/views.py Events.__get_dynamic_attr/original