Skip to content

Commit

Permalink
Merge pull request #14 from guewen/add-priority-in-options
Browse files Browse the repository at this point in the history
base_import_async: allow to set the base priority
  • Loading branch information
nbessi committed Jun 23, 2015
2 parents e8b72a0 + 7487010 commit bbef214
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion base_import_async/models/base_import_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
# options defined in base_import_async/import.js
OPT_USE_CONNECTOR = 'use_connector'
OPT_CHUNK_SIZE = 'chunk_size'
# option not available in UI, but usable from scripts
OPT_PRIORITY = 'priority'

INIT_PRIORITY = 100
DEFAULT_CHUNK_SIZE = 100
Expand Down Expand Up @@ -149,7 +151,7 @@ def split_file(session, model_name, translated_model_name,
model_obj = session.pool[model_name]
fields, data = _read_csv_attachment(session, att_id, options)
padding = len(str(len(data)))
priority = INIT_PRIORITY
priority = options.get(OPT_PRIORITY, INIT_PRIORITY)
if options.get(OPT_HAS_HEADER):
header_offset = 1
else:
Expand Down

0 comments on commit bbef214

Please sign in to comment.