I encountered with the following error:
NameError: name 'JsonCleaner' is not defined
The line, causing the error is the first pair in dictionary ERROR_CODES_MAPPING_DICT (see code below):
from sshop.engine.models import WrongJsonError
class JsonCleaner:
class NormalizeError(Exception):
ERROR_NO_CODE = 0
ERROR_TYPE_MISMATCH = 1
ERROR_WRONG_VALUE = 2
ERROR_LACK_OF_FIELD = 3
def __init__(self, error_desc, error_code=ERROR_NO_CODE):
self.error_desc = error_desc
self.error_code = error_code
def __unicode__(self):
return repr(self.error_desc)
# .... some methods ........
ERROR_CODES_MAPPING_DICT = {
# Line where exception is raised:
JsonCleaner.NormalizeError.ERROR_NO_CODE: WrongJsonError.NO_ERROR,
JsonCleaner.NormalizeError.ERROR_LACK_OF_FIELD: WrongJsonError.ERROR_LACK_OF_FIELD,
JsonCleaner.NormalizeError.ERROR_TYPE_MISMATCH: WrongJsonError.ERROR_TYPE_MISMATCH,
JsonCleaner.NormalizeError.ERROR_WRONG_VALUE: WrongJsonError.ERROR_WRONG_VALUE,
}
What am I doing wrong?