diff options
-rw-r--r-- | app/utils/batch/batch_op.py | 16 | ||||
-rw-r--r-- | app/utils/batch/common.py | 9 |
2 files changed, 13 insertions, 12 deletions
diff --git a/app/utils/batch/batch_op.py b/app/utils/batch/batch_op.py index e7515cf..ef99138 100644 --- a/app/utils/batch/batch_op.py +++ b/app/utils/batch/batch_op.py @@ -44,19 +44,19 @@ class BatchOperation(object): :param operation_id: Optional name for this operation. :type operation_id: string """ - self._database = database - self._operation_id = operation_id self._collection = collection + self._database = database + self._limit = None self._operation = None + self._operation_id = operation_id + self._skip = None self.args = [] - self.kwargs = {} - self.query_args = {} - self.valid_keys = None self.document_id = None + self.kwargs = {} self.method = None + self.query_args = {} self.query_args_func = None - self._limit = None - self._skip = None + self.valid_keys = None @property def operation(self): @@ -125,7 +125,7 @@ class BatchOperation(object): 'fields': hcommon.get_query_fields(self.query_args_func) } else: - # Get the spec and perform the query, can perform and aggregation + # Get the spec and perform the query, can perform an aggregation # as well. spec, sort, fields, self._skip, self._limit, unique = \ hcommon.get_all_query_values( diff --git a/app/utils/batch/common.py b/app/utils/batch/common.py index 0bb8b3d..64c6ebd 100644 --- a/app/utils/batch/common.py +++ b/app/utils/batch/common.py @@ -119,10 +119,11 @@ def get_batch_query_args(query): # Can't have query with just one element, they have to be # key=value. if len(arg) > 1: - if args.get(arg[0], None): + try: + args[arg[0]].append(arg[1]) + args[arg[0]] = list(set(args[arg[0]])) + except KeyError: + args[arg[0]] = [] args[arg[0]].append(arg[1]) - else: - args[arg[0]] = list([arg[1]]) - args[arg[0]] = list(set(args[arg[0]])) return args |