summaryrefslogtreecommitdiffstats
path: root/forum/utils/functions.py
blob: da6a2caec076a37a64703af67484cf357e639019 (plain)
1
2
3
4
5
6
7
8
9
10
11
def get_from_dict_or_object(source, key):
    try:
        return source[key]
    except:
        return getattr(source,key)

def is_iterable(thing):
    if hasattr(thing, '__iter__'):
        return True
    else:
        return isinstance(thing, basestring)