# Path: mtr/sync/lib/signals.py

# 
# Path: mtr/sync/lib/exceptions.py
# class ErrorChoicesMixin(object):
#     IMPORT_DATA = 0
#     UNDEFINED = 1
# 
#     STEP_CHOICES = (
#         (IMPORT_DATA, _('import data')),
#         (UNDEFINED, _('unexpected error'))
#     )
# 
# Path: mtr/sync/settings.py
# SETTINGS = getattr_with_prefix('SYNC', 'SETTINGS', {
#     'path': get_buffer_file_path,
#     'default_processor': 'XlsxProcessor',
#     'actions': ['mtr.sync.lib.actions'],
#     'converters': ['mtr.sync.lib.converters'],
#     'processors': [
#         'mtr.sync.lib.processors.xlsx',
#         'mtr.sync.lib.processors.xls',
#         'mtr.sync.lib.processors.ods',
#         'mtr.sync.lib.processors.csv',
#     ],
#     'broker': 'rq',
#     'include': {
#         'api': False,
#         'admin': True,
#     }
# })


import os
import traceback
from django.utils.six.moves import range
from django.utils import timezone
from django.db import transaction, Error
from django.core.exceptions import ValidationError
from .signals import export_started, export_completed, \
    import_started, import_completed, error_raised
from .exceptions import ErrorChoicesMixin
from ..settings import SETTINGS

            kwargs = dict(
                processor=self, path=path, fields=data['fields'],
                params=params, raw_attrs=_model,
                mfields=data['mfields'],
            )

            if use_transaction:
                sid = transaction.savepoint()

            try:
                context = action(
                    model, model_attrs, related_attrs, context, **kwargs)
            except (Error, ValueError, ValidationError,
                    AttributeError, TypeError, IndexError):
                if use_transaction:
                    transaction.savepoint_rollback(sid)

                error_message = traceback.format_exc()

                value = {
                    'model_attrs': model_attrs,
                    'related_attrs': related_attrs
                }

                error_raised.send(
                    self,
                    error=error_message,
                    position=row,
                    value=value,

# Path: mtr/sync/lib/signals.py

# 
# Path: mtr/sync/lib/exceptions.py
# class ErrorChoicesMixin(object):
#     IMPORT_DATA = 0
#     UNDEFINED = 1
# 
#     STEP_CHOICES = (
#         (IMPORT_DATA, _('import data')),
#         (UNDEFINED, _('unexpected error'))
#     )
# 
# Path: mtr/sync/settings.py
# SETTINGS = getattr_with_prefix('SYNC', 'SETTINGS', {
#     'path': get_buffer_file_path,
#     'default_processor': 'XlsxProcessor',
#     'actions': ['mtr.sync.lib.actions'],
#     'converters': ['mtr.sync.lib.converters'],
#     'processors': [
#         'mtr.sync.lib.processors.xlsx',
#         'mtr.sync.lib.processors.xls',
#         'mtr.sync.lib.processors.ods',
#         'mtr.sync.lib.processors.csv',
#     ],
#     'broker': 'rq',
#     'include': {
#         'api': False,
#         'admin': True,
#     }
# })


# Path: mtr/sync/lib/processor.py
import os
import traceback
from django.utils.six.moves import range
from django.utils import timezone
from django.db import transaction, Error
from django.core.exceptions import ValidationError
from .signals import export_started, export_completed, \
    import_started, import_completed, error_raised
from .exceptions import ErrorChoicesMixin
from ..settings import SETTINGS


            kwargs = dict(
                processor=self, path=path, fields=data['fields'],
                params=params, raw_attrs=_model,
                mfields=data['mfields'],
            )

            if use_transaction:
                sid = transaction.savepoint()

            try:
                context = action(
                    model, model_attrs, related_attrs, context, **kwargs)
            except (Error, ValueError, ValidationError,
                    AttributeError, TypeError, IndexError):
                if use_transaction:
                    transaction.savepoint_rollback(sid)

                error_message = traceback.format_exc()

                value = {
                    'model_attrs': model_attrs,
                    'related_attrs': related_attrs
                }

                error_raised.send(
                    self,
                    error=error_message,
                    position=row,
                    value=value,

                    step=ErrorChoicesMixin.IMPORT_DATA)