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

Side by Side Diff: sitescripts/extensions/bin/createNightlies.py

Issue 29350318: Issue 4382 - Use new syntax to catch exceptions in sitescripts (Closed)
Patch Set: Created Aug. 30, 2016, 1:28 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
« no previous file with comments | « sitescripts/crashes/web/submitCrash.py ('k') | sitescripts/extensions/utils.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 418
419 class CSRFParser(HTMLParser.HTMLParser): 419 class CSRFParser(HTMLParser.HTMLParser):
420 result = None 420 result = None
421 dummy_exception = Exception() 421 dummy_exception = Exception()
422 422
423 def __init__(self, data): 423 def __init__(self, data):
424 HTMLParser.HTMLParser.__init__(self) 424 HTMLParser.HTMLParser.__init__(self)
425 try: 425 try:
426 self.feed(data) 426 self.feed(data)
427 self.close() 427 self.close()
428 except Exception, e: 428 except Exception as e:
429 if e != self.dummy_exception: 429 if e != self.dummy_exception:
430 raise 430 raise
431 431
432 if not self.result: 432 if not self.result:
433 raise Exception('Failed to extract CSRF token') 433 raise Exception('Failed to extract CSRF token')
434 434
435 def set_result(self, value): 435 def set_result(self, value):
436 self.result = value 436 self.result = value
437 raise self.dummy_exception 437 raise self.dummy_exception
438 438
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 620
621 # build all extensions specified in the configuration file 621 # build all extensions specified in the configuration file
622 # and generate changelogs and documentations for each: 622 # and generate changelogs and documentations for each:
623 data = None 623 data = None
624 for repo in Configuration.getRepositoryConfigurations(nightlyConfig): 624 for repo in Configuration.getRepositoryConfigurations(nightlyConfig):
625 build = None 625 build = None
626 try: 626 try:
627 build = NightlyBuild(repo) 627 build = NightlyBuild(repo)
628 if build.hasChanges(): 628 if build.hasChanges():
629 build.run() 629 build.run()
630 except Exception, ex: 630 except Exception as ex:
631 logging.error('The build for %s failed:', repo) 631 logging.error('The build for %s failed:', repo)
632 logging.exception(ex) 632 logging.exception(ex)
633 633
634 file = open(nightlyConfigFile, 'wb') 634 file = open(nightlyConfigFile, 'wb')
635 nightlyConfig.write(file) 635 nightlyConfig.write(file)
636 636
637 637
638 if __name__ == '__main__': 638 if __name__ == '__main__':
639 main() 639 main()
OLDNEW
« no previous file with comments | « sitescripts/crashes/web/submitCrash.py ('k') | sitescripts/extensions/utils.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld