Add key name to error message

develop
Спиридонов Денис 12 years ago
parent cb305c0629
commit d7b223a4e9

@ -335,8 +335,8 @@ def main():
homePath = clVarsCore.Get('ur_home_path')
# translate
if args.lang:
print 'code not found!!!!'
# if args.lang:
# print 'code not found!!!!'
port = args.port
host = args.host

@ -103,14 +103,26 @@ def call_method(client, args, wait_thread):
param_object['CheckOnly'] = True
# print param_object
method_result = client.service[0][method](client.sid, param_object)
if not method_result:
print _('method is not available')
return None
if method_result.ReturnedMessage[0].type and \
method_result.ReturnedMessage[0].type != "pid":
wait_thread.stop()
for error in method_result.ReturnedMessage:
params_text = ''
for Group in view.groups.GroupField:
for field in Group.fields.Field:
if field.name == error.field:
if field.opt.shortopt or field.opt.longopt:
params_text += _('Error in parameter ')
params_text += ', '.join(filter(None,
[field.opt.shortopt, field.opt.longopt])) \
+ '. '
red = '\033[91m * \033[0m'
print red + error.message
print red + params_text + error.message
return None
view_params = get_view_params(client, method + '_view', step = None, \
@ -139,8 +151,16 @@ def call_method(client, args, wait_thread):
if method_result.ReturnedMessage[0].type and \
method_result.ReturnedMessage[0].type != "pid":
for error in method_result.ReturnedMessage:
params_text = ''
for Group in view.groups.GroupField:
for field in Group.fields.Field:
if field.name == error.field:
if field.opt.shortopt or field.opt.longopt:
params_text += _('Error in parameter ')
params_text += ', '.join(filter(None,
[field.opt.shortopt, field.opt.longopt]))+'. '
red = '\033[91m * \033[0m'
print red + error.message
print red + params_text + error.message
return None
wait_thread.stop()
return method_result

@ -2,8 +2,8 @@ msgid ""
msgstr ""
"Project-Id-Version: console_gui_translate\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-06-09 12:31+0300\n"
"PO-Revision-Date: 2012-06-09 12:32+0300\n"
"POT-Creation-Date: 2012-06-09 14:17+0300\n"
"PO-Revision-Date: 2012-06-09 14:17+0300\n"
"Last-Translator: Denis <ds@mail.ru>\n"
"Language-Team: \n"
"Language: \n"
@ -87,17 +87,17 @@ msgid "Process not found"
msgstr "Процесс не найден"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:142
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:260
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:261
msgid "Certificate not found in server database"
msgstr "Сертификат не найден в БД сервера"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:144
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:262
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:263
msgid "Session doesn't belong to your certificate"
msgstr "Сессия не соответствует Вашему сертификату"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:146
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:264
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:265
msgid "It was not possible to kill process"
msgstr "Не удалось завершить процесс"
@ -293,55 +293,59 @@ msgstr "обновить список отзыва сертификатов"
msgid "stop cl-consoled"
msgstr "остановить cl-consoled"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:258
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:259
msgid "Process is terminated"
msgstr "Процесс завершён"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:352
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:353
#, python-format
msgid "cannot create directory %s"
msgstr "Не удалось создать директорию %s"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:390
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:391
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:29
msgid "Failed to connect"
msgstr "Не удалось подключиться"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:451
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:452
msgid "Password is invalid"
msgstr "Неверный пароль"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:457
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:473
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:458
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:474
msgid "Error: "
msgstr "Ошибка: "
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:485
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:488
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:490
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:486
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:489
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:491
#, python-format
msgid "Exception: %s"
msgstr "Исключение: %s"
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:107
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:137
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:108
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:148
msgid "method is not available"
msgstr "Метод не доступен"
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:123
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:118
msgid "Error in parameter "
msgstr "Ошибка в параметре "
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:134
msgid "Run process? (yes/no): "
msgstr "Запустить процесс? (yes/no): "
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:129
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:140
msgid "Interrupted by user"
msgstr "Прервано пользователем"
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:212
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:228
#, python-format
msgid "Password for %s: "
msgstr "Пароль для %s: "
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:213
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:229
#, python-format
msgid "Repeat password for %s: "
msgstr "Повтор пароля для %s: "

Loading…
Cancel
Save