Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: cms/translations/xtm/projects_handler.py

Issue 29908581: Issue #7036 - [XTM Integration] Add support for providing workflow name (Closed)
Patch Set: Created Oct. 12, 2018, 2:03 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-present eyeo GmbH 2 # Copyright (C) 2006-present eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 project_id, resulting_jobs = utils.run_and_wait( 64 project_id, resulting_jobs = utils.run_and_wait(
65 api.create_project, 65 api.create_project,
66 XTMCloudException, 66 XTMCloudException,
67 const.UNDER_ANALYSIS_MESSAGE, 67 const.UNDER_ANALYSIS_MESSAGE,
68 const.InfoMessages.WAITING_FOR_PROJECT, 68 const.InfoMessages.WAITING_FOR_PROJECT,
69 name=name, 69 name=name,
70 description=args.desc, 70 description=args.desc,
71 reference_id=args.ref_id, 71 reference_id=args.ref_id,
72 target_languages=target_langs, 72 target_languages=target_langs,
73 customer_id=args.client_id, 73 customer_id=args.client_id,
74 workflow_id=args.workflow_id, 74 workflow_id=utils.extract_workflow_id(api, args),
75 source_language=args.source_lang, 75 source_language=args.source_lang,
76 files=files_to_upload, 76 files=files_to_upload,
77 ) 77 )
78 except XTMCloudException as err: 78 except Exception as err:
79 sys.exit(err) 79 sys.exit(err)
80 80
81 logging.info(const.InfoMessages.PROJECT_CREATED.format(project_id)) 81 logging.info(const.InfoMessages.PROJECT_CREATED.format(project_id))
82 utils.log_resulting_jobs(resulting_jobs) 82 utils.log_resulting_jobs(resulting_jobs)
83 83
84 if args.save_id: 84 if args.save_id:
85 source.write_to_config( 85 source.write_to_config(
86 const.Config.XTM_SECTION, 86 const.Config.XTM_SECTION,
87 const.Config.PROJECT_OPTION, 87 const.Config.PROJECT_OPTION,
88 str(project_id), 88 str(project_id),
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 utils.write_to_file(zf.read(name), path) 181 utils.write_to_file(zf.read(name), path)
182 logging.info(const.InfoMessages.FILE_SAVED.format( 182 logging.info(const.InfoMessages.FILE_SAVED.format(
183 path, 183 path,
184 zf.getinfo(name).file_size, 184 zf.getinfo(name).file_size,
185 )) 185 ))
186 logging.info(const.InfoMessages.GREETINGS) 186 logging.info(const.InfoMessages.GREETINGS)
187 except zipfile.BadZipfile: 187 except zipfile.BadZipfile:
188 sys.exit(const.ErrorMessages.NO_TARGET_FILES_FOUND) 188 sys.exit(const.ErrorMessages.NO_TARGET_FILES_FOUND)
189 except IOError: 189 except IOError:
190 sys.exit(const.ErrorMessages.COULD_NOT_SAVE_FILES) 190 sys.exit(const.ErrorMessages.COULD_NOT_SAVE_FILES)
OLDNEW

Powered by Google App Engine
This is Rietveld