Update exception detection to work with Python3 format.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -65,7 +65,7 @@ class MayanAppConfig(apps.AppConfig):
|
|||||||
)
|
)
|
||||||
),
|
),
|
||||||
except ImportError as exception:
|
except ImportError as exception:
|
||||||
if force_text(exception) != 'No module named urls':
|
if force_text(exception) not in ('No module named urls', 'No module named \'{}.urls\''.format(self.name)):
|
||||||
logger.error(
|
logger.error(
|
||||||
'Import time error when running AppConfig.ready(). Check '
|
'Import time error when running AppConfig.ready(). Check '
|
||||||
'apps.py, urls.py, views.py, etc.'
|
'apps.py, urls.py, views.py, etc.'
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ class WorkflowAction(six.with_metaclass(WorkflowActionMetaclass, WorkflowActionB
|
|||||||
try:
|
try:
|
||||||
import_module('{}.workflow_actions'.format(app.name))
|
import_module('{}.workflow_actions'.format(app.name))
|
||||||
except ImportError as exception:
|
except ImportError as exception:
|
||||||
if force_text(exception) != 'No module named workflow_actions':
|
if force_text(exception) not in ('No module named workflow_actions', 'No module named \'{}.workflow_actions\''.format(app.name)):
|
||||||
logger.error(
|
logger.error(
|
||||||
'Error importing %s workflow_actions.py file; %s',
|
'Error importing %s workflow_actions.py file; %s',
|
||||||
app.name, exception
|
app.name, exception
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ class MailerBackend(six.with_metaclass(MailerBackendMetaclass, MailerBackendBase
|
|||||||
try:
|
try:
|
||||||
import_module('{}.mailers'.format(app.name))
|
import_module('{}.mailers'.format(app.name))
|
||||||
except ImportError as exception:
|
except ImportError as exception:
|
||||||
if force_text(exception) != 'No module named mailers':
|
if force_text(exception) not in ('No module named mailers', 'No module named \'{}.mailers\''.format(app.name)):
|
||||||
logger.error(
|
logger.error(
|
||||||
'Error importing %s mailers.py file; %s', app.name,
|
'Error importing %s mailers.py file; %s', app.name,
|
||||||
exception
|
exception
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class Namespace(object):
|
|||||||
try:
|
try:
|
||||||
import_module('{}.settings'.format(app.name))
|
import_module('{}.settings'.format(app.name))
|
||||||
except ImportError as exception:
|
except ImportError as exception:
|
||||||
if force_text(exception) != 'No module named settings':
|
if force_text(exception) not in ('No module named settings', 'No module named \'{}.settings\''.format(app.name)):
|
||||||
logger.error(
|
logger.error(
|
||||||
'Error importing %s settings.py file; %s', app.name,
|
'Error importing %s settings.py file; %s', app.name,
|
||||||
exception
|
exception
|
||||||
@@ -84,7 +84,7 @@ class Setting(object):
|
|||||||
result = yaml.safe_dump(value, allow_unicode=True)
|
result = yaml.safe_dump(value, allow_unicode=True)
|
||||||
# safe_dump returns bytestrings
|
# safe_dump returns bytestrings
|
||||||
# Disregard the last 3 dots that mark the end of the YAML document
|
# Disregard the last 3 dots that mark the end of the YAML document
|
||||||
if result.endswith(b'...\n'):
|
if force_text(result).endswith('...\n'):
|
||||||
result = result[:-4]
|
result = result[:-4]
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user