diff options
Diffstat (limited to 'forum/utils/functions.py')
-rw-r--r-- | forum/utils/functions.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/forum/utils/functions.py b/forum/utils/functions.py index 671ddc2c..da6a2cae 100644 --- a/forum/utils/functions.py +++ b/forum/utils/functions.py @@ -1,5 +1,11 @@ -def get_from_dict_or_object(object,key): +def get_from_dict_or_object(source, key): try: - return object[key] + return source[key] except: - return getattr(object,key) + return getattr(source,key) + +def is_iterable(thing): + if hasattr(thing, '__iter__'): + return True + else: + return isinstance(thing, basestring) |