Mercurial > babel > old > mirror
comparison babel/messages/frontend.py @ 210:b714a9bd4d0d
Make frontends that make use of a ''loop all'' fail if no message catalogs are found.
author | palgarvio |
---|---|
date | Wed, 04 Jul 2007 16:09:05 +0000 |
parents | 22232d21dca0 |
children | 9d102737797c |
comparison
equal
deleted
inserted
replaced
209:22232d21dca0 | 210:b714a9bd4d0d |
---|---|
125 mo_files.append(self.output_file) | 125 mo_files.append(self.output_file) |
126 else: | 126 else: |
127 mo_files.append(os.path.join(self.directory, locale, | 127 mo_files.append(os.path.join(self.directory, locale, |
128 'LC_MESSAGES', | 128 'LC_MESSAGES', |
129 self.domain + '.mo')) | 129 self.domain + '.mo')) |
130 | |
131 if not po_files: | |
132 raise DistutilsOptionError('no message catalogs found') | |
130 | 133 |
131 for idx, po_file in enumerate(po_files): | 134 for idx, po_file in enumerate(po_files): |
132 mo_file = mo_files[idx] | 135 mo_file = mo_files[idx] |
133 infile = open(po_file, 'r') | 136 infile = open(po_file, 'r') |
134 try: | 137 try: |
526 try: | 529 try: |
527 template = read_po(infile) | 530 template = read_po(infile) |
528 finally: | 531 finally: |
529 infile.close() | 532 infile.close() |
530 | 533 |
534 if not po_files: | |
535 raise DistutilsOptionError('no message catalogs found') | |
536 | |
531 for locale, filename in po_files: | 537 for locale, filename in po_files: |
532 log.info('updating catalog %r based on %r', filename, | 538 log.info('updating catalog %r based on %r', filename, |
533 self.input_file) | 539 self.input_file) |
534 infile = open(filename, 'U') | 540 infile = open(filename, 'U') |
535 try: | 541 try: |
690 parser.error('you must specify either the input file or ' | 696 parser.error('you must specify either the input file or ' |
691 'the base directory') | 697 'the base directory') |
692 mo_files.append(os.path.join(options.directory, locale, | 698 mo_files.append(os.path.join(options.directory, locale, |
693 'LC_MESSAGES', | 699 'LC_MESSAGES', |
694 options.domain + '.mo')) | 700 options.domain + '.mo')) |
701 if not po_files: | |
702 parser.error('no message catalogs found') | |
695 | 703 |
696 for idx, po_file in enumerate(po_files): | 704 for idx, po_file in enumerate(po_files): |
697 mo_file = mo_files[idx] | 705 mo_file = mo_files[idx] |
698 infile = open(po_file, 'r') | 706 infile = open(po_file, 'r') |
699 try: | 707 try: |
976 try: | 984 try: |
977 template = read_po(infile) | 985 template = read_po(infile) |
978 finally: | 986 finally: |
979 infile.close() | 987 infile.close() |
980 | 988 |
989 if not po_files: | |
990 parser.error('no message catalogs found') | |
991 | |
981 for locale, filename in po_files: | 992 for locale, filename in po_files: |
982 print 'updating catalog %r based on %r' % (filename, | 993 print 'updating catalog %r based on %r' % (filename, |
983 options.input_file) | 994 options.input_file) |
984 infile = open(filename, 'U') | 995 infile = open(filename, 'U') |
985 try: | 996 try: |