Only to validate statements if these exists

This commit is contained in:
Oscar Alvarez 2015-09-01 23:30:06 -05:00
parent 84e520771c
commit a479a4397b

View File

@ -142,8 +142,8 @@ class OpenStatement(Wizard):
def __setup__(cls): def __setup__(cls):
super(OpenStatement, cls).__setup__() super(OpenStatement, cls).__setup__()
cls._error_messages.update({ cls._error_messages.update({
'open_statement': 'Statement %s opened.\n', 'open_statement': 'Statement %s opened. \n',
'statement_already_opened': 'Statement %s already opened.\n', 'statement_already_opened': 'Statement %s already opened. \n',
'user_without_device': 'User %s has not any device assigned yet.' 'user_without_device': 'User %s has not any device assigned yet.'
'\n', '\n',
}) })
@ -232,9 +232,9 @@ class CloseStatement(Wizard):
def __setup__(cls): def __setup__(cls):
super(CloseStatement, cls).__setup__() super(CloseStatement, cls).__setup__()
cls._error_messages.update({ cls._error_messages.update({
'close_statement': 'Statement %s closed.\n', 'close_statement': 'Statement %s closed. \n',
'statement_already_closed': 'Statement %s already closed.\n', 'statement_already_closed': 'Statement %s already closed. \n',
'not_statement_found': 'Statement %s not found.\n', 'not_statement_found': 'Statement %s not found. \n',
'user_without_device': 'User %s has not any device assigned yet.' 'user_without_device': 'User %s has not any device assigned yet.'
'\n', '\n',
}) })
@ -283,7 +283,8 @@ class CloseStatement(Wizard):
result += self.raise_user_error('not_statement_found', result += self.raise_user_error('not_statement_found',
error_args=(journal.rec_name,), error_args=(journal.rec_name,),
raise_exception=False) raise_exception=False)
Statement.validate_statement(statements) if statements:
Statement.validate_statement(statements)
self.result = result self.result = result
else: else:
self.result = self.raise_user_error('user_without_device', self.result = self.raise_user_error('user_without_device',