diff --git a/ietf/utils/listop.py b/ietf/utils/listop.py index 7a446969e..bd9e0c149 100644 --- a/ietf/utils/listop.py +++ b/ietf/utils/listop.py @@ -3,11 +3,17 @@ import operator def orl(list): """ Return the "or" of every element in a list. Used to generate "or" queries with a list of Q objects. """ - return reduce(operator.__or__, list) - + if list: + return reduce(operator.__or__, list) + else: + return None + def flattenl(list): """ Flatten a list one level, e.g., turn [ ['a'], ['b'], ['c', 'd'] ] into [ 'a', 'b', 'c', 'd' ] """ - return reduce(operator.__concat__, list) + if list: + return reduce(operator.__concat__, list) + else: + return [] \ No newline at end of file