diff --git a/bin/tryton b/bin/tryton index 0ca9fe47a5..85eedaf0d8 100755 --- a/bin/tryton +++ b/bin/tryton @@ -5,7 +5,7 @@ try: '..', '..', 'tryton'))) if os.path.isdir(DIR): sys.path.insert(0, os.path.dirname(DIR)) -except: +except Exception: pass # True only if running as a py2exe app diff --git a/tryton/client.py b/tryton/client.py index 782d840abd..39e9222fc3 100644 --- a/tryton/client.py +++ b/tryton/client.py @@ -58,7 +58,7 @@ class TrytonClient(object): try: pixbuf = gtk.gdk.pixbuf_new_from_file( os.path.join(PIXMAPS_DIR, fname)) - except: + except Exception: continue icon_set = gtk.IconSet(pixbuf) factory.add(name, icon_set) diff --git a/tryton/common/cellrendererfloat.py b/tryton/common/cellrendererfloat.py index 6bdec007e2..9c527696c7 100644 --- a/tryton/common/cellrendererfloat.py +++ b/tryton/common/cellrendererfloat.py @@ -32,7 +32,7 @@ class CellRendererFloat(CellRendererInteger): or len(new_decimal) > self.digits[1]: entry.stop_emission('insert-text') - except: + except Exception: entry.stop_emission('insert-text') gobject.type_register(CellRendererFloat) diff --git a/tryton/common/cellrendererinteger.py b/tryton/common/cellrendererinteger.py index 1711ae85ad..b8c5fac751 100644 --- a/tryton/common/cellrendererinteger.py +++ b/tryton/common/cellrendererinteger.py @@ -24,7 +24,7 @@ class CellRendererInteger(CellRendererText): if new_value == '-': return locale.atoi(new_value) - except: + except Exception: entry.stop_emission('insert-text') gobject.type_register(CellRendererInteger) diff --git a/tryton/common/common.py b/tryton/common/common.py index 480e57db92..eefa7fb545 100644 --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -243,7 +243,7 @@ def file_selection(title, filename='', parent=None, pixbuf = gtk.gdk.pixbuf_new_from_file_at_size(filename, 128, 128) img.set_from_pixbuf(pixbuf) have_preview = True - except: + except Exception: have_preview = False win.set_preview_widget_active(have_preview) return @@ -266,7 +266,7 @@ def file_selection(title, filename='', parent=None, CONFIG['client.default_path'] = \ os.path.dirname(filepath) CONFIG.save() - except: + except Exception: pass parent.present() win.destroy() @@ -278,7 +278,7 @@ def file_selection(title, filename='', parent=None, try: CONFIG['client.default_path'] = \ os.path.dirname(filenames[0]) - except: + except Exception: pass parent.present() win.destroy() @@ -291,11 +291,11 @@ def file_open(filename, type, parent, print_p=False): operation = 'print' try: os.startfile(os.path.normpath(filename), operation) - except: + except Exception: # Try without operation, it is not supported on version < 2.5 try: os.startfile(os.path.normpath(filename)) - except: + except Exception: save_name = file_selection(_('Save As...'), parent=parent, action=gtk.FILE_CHOOSER_ACTION_SAVE) if save_name: @@ -313,7 +313,7 @@ def file_open(filename, type, parent, print_p=False): if not pid: try: os.execv('/usr/bin/open', ['/usr/bin/open', filename]) - except: + except Exception: sys.exit(0) time.sleep(0.1) sys.exit(0) @@ -353,7 +353,7 @@ def file_open(filename, type, parent, print_p=False): if not pid: try: os.execv(prog, args) - except: + except Exception: sys.exit(0) time.sleep(0.1) sys.exit(0) @@ -380,7 +380,7 @@ def mailto(to=None, cc=None, subject=None, body=None, attachment=None): if not pid: try: os.execv(prog, args) - except: + except Exception: sys.exit(0) time.sleep(0.1) sys.exit(0) @@ -1078,7 +1078,7 @@ def text_to_float_time(text, conv=None): try: try: return locale.atof(text) - except: + except Exception: pass if conv: tmp_conv = FLOAT_TIME_CONV.copy() @@ -1104,7 +1104,7 @@ def text_to_float_time(text, conv=None): try: value += abs(locale.atof(buf)) continue - except: + except Exception: pass for sep in conv.keys(): if buf.endswith(sep): @@ -1113,7 +1113,7 @@ def text_to_float_time(text, conv=None): if text.startswith('-'): value *= -1 return value - except: + except Exception: return 0.0 def float_time_to_text(val, conv=None): diff --git a/tryton/common/date_widget.py b/tryton/common/date_widget.py index 4ad676a2dc..f3cfa761c6 100644 --- a/tryton/common/date_widget.py +++ b/tryton/common/date_widget.py @@ -185,7 +185,7 @@ class DateEntry(gtk.Entry): try: time.strptime(self.compute_date(text, default=default, year='2000'), self.format) - except: + except Exception: return False return True @@ -194,7 +194,7 @@ class DateEntry(gtk.Entry): date = self.compute_date(self.get_text()) try: res = datetime.datetime(*time.strptime(date, self.format)[:6]) - except: + except Exception: return None self.set_text(date) return res @@ -327,7 +327,7 @@ def compute_date(cmd, dt, format): dt = datetime.datetime.now() try: return f(dt, groups) - except: + except Exception: continue if __name__ == '__main__': diff --git a/tryton/config.py b/tryton/config.py index c825927510..441d819834 100644 --- a/tryton/config.py +++ b/tryton/config.py @@ -137,7 +137,7 @@ class ConfigManager(object): configparser.add_section(section) configparser.set(section, name, self.config[entry]) configparser.write(open(self.rcfile, 'wb')) - except: + except Exception: logging.getLogger('common.options').warn( _('Unable to write config file %s!') % \ (self.rcfile,)) diff --git a/tryton/gui/main.py b/tryton/gui/main.py index 75c18a3532..092ffd5911 100644 --- a/tryton/gui/main.py +++ b/tryton/gui/main.py @@ -34,7 +34,7 @@ except ImportError: igemacintegration = None try: import gtkspell -except: +except Exception: gtkspell = None _ = gettext.gettext @@ -936,7 +936,7 @@ class Main(object): try: shortcuts = rpc.execute('model', 'ir.ui.view_sc', 'get_sc', user, 'ir.ui.menu', rpc.CONTEXT) - except: + except Exception: shortcuts = [] menu = gtk.Menu() for shortcut in shortcuts: @@ -1096,7 +1096,7 @@ class Main(object): len(ids2)) self.sb_requests.set_text(message) return (ids, ids2) - except: + except Exception: if exception: raise return ([], []) @@ -1123,7 +1123,7 @@ class Main(object): try: prefs = rpc.execute('model', 'res.user', 'get_preferences', False, rpc.CONTEXT) - except: + except Exception: prefs = None if prefs and 'language_direction' in prefs: translate.set_language_direction(prefs['language_direction']) diff --git a/tryton/gui/window/dbcreate.py b/tryton/gui/window/dbcreate.py index 757ca92759..82b7968d47 100644 --- a/tryton/gui/window/dbcreate.py +++ b/tryton/gui/window/dbcreate.py @@ -67,7 +67,7 @@ class DBCreate(object): if self.combo_language and host and port: common.refresh_langlist(self.combo_language, host, port) self.server_connection_state(True) - except: + except Exception: self.server_connection_state(False) return False CONFIG['login.server'] = host @@ -317,7 +317,7 @@ class DBCreate(object): self.combo_language.set_model(liststore) try: common.refresh_langlist(self.combo_language, host, port) - except: + except Exception: self.button_create.set_sensitive(False) while True: diff --git a/tryton/gui/window/form.py b/tryton/gui/window/form.py index 8cdedf3889..d7e68f9401 100644 --- a/tryton/gui/window/form.py +++ b/tryton/gui/window/form.py @@ -184,7 +184,7 @@ class Form(SignalEvent): new_value = value[:position] + new_text + value[position:] try: locale.atoi(new_value) - except: + except Exception: widget.stop_emission('insert-text') entry.connect('insert_text', sig_insert_text) table.attach(entry, 1, 2, 1, 2) @@ -275,7 +275,7 @@ class Form(SignalEvent): sdt = szone.localize(datetime, is_dst=True) ldt = sdt.astimezone(lzone) date = ldt - except: + except Exception: pass value = common.datetime_strftime(date, display_format) message_str += val + ' ' + value +'\n' diff --git a/tryton/gui/window/tips.py b/tryton/gui/window/tips.py index 9627341cc1..0f2fd5dbf9 100644 --- a/tryton/gui/window/tips.py +++ b/tryton/gui/window/tips.py @@ -92,7 +92,7 @@ You can save any graphs in PNG file with right-click on it. try: self.number = int(CONFIG['tip.position']) - except: + except Exception: self.number = 0 self.tip_set() diff --git a/tryton/gui/window/tree.py b/tryton/gui/window/tree.py index 46d333d67c..424c24172b 100644 --- a/tryton/gui/window/tree.py +++ b/tryton/gui/window/tree.py @@ -197,7 +197,7 @@ class Tree(SignalEvent): try: icon.set_from_stock(res[icon_name], gtk.ICON_SIZE_BUTTON) - except: + except Exception: pass hbox = gtk.HBox(spacing=6) diff --git a/tryton/gui/window/view_form/model/field.py b/tryton/gui/window/view_form/model/field.py index 2e5b460e12..0b78a6c2f2 100644 --- a/tryton/gui/window/view_form/model/field.py +++ b/tryton/gui/window/view_form/model/field.py @@ -88,7 +88,7 @@ class CharField(object): record.modified_fields.setdefault(self.name) try: self.sig_changed(record) - except: + except Exception: record.value[self.name] = internal record.modified = prev_modified return @@ -191,7 +191,7 @@ class FloatField(CharField): record.modified_fields.setdefault(self.name) try: self.sig_changed(record) - except: + except Exception: record.value[self.name] = internal record.modified = prev_modified record.signal('record-changed') @@ -213,7 +213,7 @@ class NumericField(CharField): record.modified_fields.setdefault(self.name) try: self.sig_changed(record) - except: + except Exception: record.value[self.name] = internal record.modified = prev_modified return @@ -240,7 +240,7 @@ class BooleanField(CharField): record.modified_fields.setdefault(self.name) try: self.sig_changed(record) - except: + except Exception: record.value[self.name] = internal record.modified = prev_modified return @@ -313,7 +313,7 @@ class M2OField(CharField): record.modified_fields.setdefault(self.name) try: self.sig_changed(record) - except: + except Exception: record.value[self.name] = internal record.modified = prev_modified return @@ -321,7 +321,7 @@ class M2OField(CharField): elif force_change: try: self.sig_changed(record) - except: + except Exception: record.value[self.name] = internal return record.signal('record-changed') @@ -603,7 +603,7 @@ class ReferenceField(CharField): record.modified_fields.setdefault(self.name) try: self.sig_changed(record) - except: + except Exception: record.value[self.name] = internal record.modified = prev_modified return diff --git a/tryton/gui/window/view_form/model/record.py b/tryton/gui/window/view_form/model/record.py index 436e928ec4..317c354a96 100644 --- a/tryton/gui/window/view_form/model/record.py +++ b/tryton/gui/window/view_form/model/record.py @@ -28,7 +28,7 @@ class EvalEnvironment(dict): def get(self, item, default=None): try: return self.__getattr__(item) - except: + except Exception: pass return super(EvalEnvironment, self).get(item, default) @@ -462,6 +462,6 @@ class Record(SignalEvent): ]) try: self.attachment_count = rpc.execute(*args) - except: + except Exception: return 0 return self.attachment_count diff --git a/tryton/gui/window/view_form/screen/screen.py b/tryton/gui/window/view_form/screen/screen.py index d86b829bf6..4274df6ead 100644 --- a/tryton/gui/window/view_form/screen/screen.py +++ b/tryton/gui/window/view_form/screen/screen.py @@ -88,7 +88,7 @@ class Screen(SignalEvent): self.fields_view_tree = rpc.execute('model', self.model_name, 'fields_view_get', False, 'tree', ctx) - except: + except Exception: return self.filter_widget = Form(self.fields_view_tree['arch'], self.fields_view_tree['fields'], self.model_name, @@ -143,7 +143,7 @@ class Screen(SignalEvent): self.model_name, 'search_count', values, ctx) else: self.search_count = len(ids) - except: + except Exception: ids = [] if only_ids: return ids @@ -201,11 +201,11 @@ class Screen(SignalEvent): self.__current_record = record try: offset = int(self.filter_widget.get_offset()) - except: + except Exception: offset = 0 try: pos = self.group.index(record) - except: + except Exception: pos = -1 self.signal('record-message', (pos + offset, len(self.group) + offset, self.search_count, record and record.id)) diff --git a/tryton/gui/window/view_form/view/form_gtk/calendar.py b/tryton/gui/window/view_form/view/form_gtk/calendar.py index 4328de9b01..80b080759b 100644 --- a/tryton/gui/window/view_form/view/form_gtk/calendar.py +++ b/tryton/gui/window/view_form/view/form_gtk/calendar.py @@ -73,7 +73,7 @@ class Calendar(WidgetInterface): return False try: date = datetime.date(*time.strptime(value, self.format)[:3]) - except: + except Exception: return False return datetime_strftime(date, DT_FORMAT) @@ -209,7 +209,7 @@ class DateTime(WidgetInterface): return False try: date = datetime.datetime(*time.strptime(value, self.format)[:6]) - except: + except Exception: return False if 'timezone' in rpc.CONTEXT and timezone: try: @@ -219,7 +219,7 @@ class DateTime(WidgetInterface): ldt = lzone.localize(date, is_dst=True) sdt = ldt.astimezone(szone) date = sdt - except: + except Exception: pass return datetime_strftime(date, DHM_FORMAT) @@ -246,7 +246,7 @@ class DateTime(WidgetInterface): sdt = szone.localize(date, is_dst=True) ldt = sdt.astimezone(lzone) date = ldt - except: + except Exception: pass format = self.format if date.year < 10: diff --git a/tryton/gui/window/view_form/view/form_gtk/float.py b/tryton/gui/window/view_form/view/form_gtk/float.py index a02012d043..0c53fab508 100644 --- a/tryton/gui/window/view_form/view/form_gtk/float.py +++ b/tryton/gui/window/view_form/view/form_gtk/float.py @@ -15,7 +15,7 @@ class Float(Integer): def set_value(self, record, field): try: value = locale.atof(self.entry.get_text()) - except: + except Exception: value = 0.0 return field.set_client(record, value) @@ -58,5 +58,5 @@ class Float(Integer): or len(new_decimal) > digits[1]: entry.stop_emission('insert-text') - except: + except Exception: entry.stop_emission('insert-text') diff --git a/tryton/gui/window/view_form/view/form_gtk/image.py b/tryton/gui/window/view_form/view/form_gtk/image.py index 2abc75f4fe..f1356c519d 100644 --- a/tryton/gui/window/view_form/view/form_gtk/image.py +++ b/tryton/gui/window/view_form/view/form_gtk/image.py @@ -158,7 +158,7 @@ class Image(WidgetInterface): try: loader = gtk.gdk.PixbufLoader(ftype) loader.write(data, len(data)) - except: + except Exception: continue pixbuf = loader.get_pixbuf() if pixbuf: diff --git a/tryton/gui/window/view_form/view/form_gtk/integer.py b/tryton/gui/window/view_form/view/form_gtk/integer.py index 800cd77104..ccc4d6d6a6 100644 --- a/tryton/gui/window/view_form/view/form_gtk/integer.py +++ b/tryton/gui/window/view_form/view/form_gtk/integer.py @@ -17,7 +17,7 @@ class Integer(Char): def set_value(self, record, field): try: value = locale.atoi(self.entry.get_text()) - except: + except Exception: value = 0 return field.set_client(record, value) @@ -41,5 +41,5 @@ class Integer(Char): if new_value == '-': return locale.atoi(new_value) - except: + except Exception: entry.stop_emission('insert-text') diff --git a/tryton/gui/window/view_form/view/form_gtk/many2many.py b/tryton/gui/window/view_form/view/form_gtk/many2many.py index 14ca3cad4a..9f1bcb07a1 100644 --- a/tryton/gui/window/view_form/view/form_gtk/many2many.py +++ b/tryton/gui/window/view_form/view/form_gtk/many2many.py @@ -165,7 +165,7 @@ class Many2Many(WidgetInterface): try: result = rpc.execute('model', self.attrs['relation'], 'read', ids, ['rec_name'], rpc.CONTEXT) - except: + except Exception: return str(ids) return ', '.join(x['rec_name'] for x in result) diff --git a/tryton/gui/window/view_form/view/form_gtk/parser.py b/tryton/gui/window/view_form/view/form_gtk/parser.py index e75f22dc8a..5988ae106a 100644 --- a/tryton/gui/window/view_form/view/form_gtk/parser.py +++ b/tryton/gui/window/view_form/view/form_gtk/parser.py @@ -104,7 +104,7 @@ class Button(object): icon = gtk.Image() icon.set_from_stock(stock, gtk.ICON_SIZE_SMALL_TOOLBAR) self.widget.set_image(icon) - except: + except Exception: log = logging.getLogger('common') log.warning(_('Wrong icon for the button!')) else: diff --git a/tryton/gui/window/view_form/view/form_gtk/textbox.py b/tryton/gui/window/view_form/view/form_gtk/textbox.py index f580699a83..114a86beb6 100644 --- a/tryton/gui/window/view_form/view/form_gtk/textbox.py +++ b/tryton/gui/window/view_form/view/form_gtk/textbox.py @@ -7,7 +7,7 @@ from tryton.config import CONFIG try: import gtkspell -except: +except Exception: gtkspell = None @@ -51,7 +51,7 @@ class TextBox(WidgetInterface): spell = None try: spell = gtkspell.get_from_text_view(self.textview) - except: + except Exception: pass if not value and self.attrs.get('spell') \ @@ -64,11 +64,11 @@ class TextBox(WidgetInterface): if self.lang != language: try: spell.set_language(language) - except: + except Exception: spell.detach() del spell self.lang = language - except: + except Exception: pass elif spell: spell.detach() @@ -98,7 +98,7 @@ class TextBox(WidgetInterface): spell = None try: spell = gtkspell.get_from_text_view(self.textview) - except: + except Exception: pass if self.attrs.get('spell') and CONFIG['client.spellcheck'] \ @@ -110,11 +110,11 @@ class TextBox(WidgetInterface): if self.lang != language: try: spell.set_language(language) - except: + except Exception: spell.detach() del spell self.lang = language - except: + except Exception: pass elif spell: spell.detach() diff --git a/tryton/gui/window/view_form/view/graph_gtk/parser.py b/tryton/gui/window/view_form/view/graph_gtk/parser.py index 6af17904bf..27a5950ab7 100644 --- a/tryton/gui/window/view_form/view/graph_gtk/parser.py +++ b/tryton/gui/window/view_form/view/graph_gtk/parser.py @@ -79,7 +79,7 @@ def save(widget, graph, window): CONFIG['client.default_path'] = \ os.path.dirname(filepath) CONFIG.save() - except: + except Exception: pass if response == gtk.RESPONSE_OK: if width and height and filename: diff --git a/tryton/gui/window/view_form/view/list.py b/tryton/gui/window/view_form/view/list.py index 86d802f85a..5ebed47d25 100644 --- a/tryton/gui/window/view_form/view/list.py +++ b/tryton/gui/window/view_form/view/list.py @@ -70,7 +70,7 @@ class AdaptModelGroup(gtk.GenericTreeModel): if old_pos != pos: new_order[old_pos] = pos pos += 1 - except: + except Exception: continue self.group.sort(lambda x, y: \ cmp(new_order[ids2pos[x.id]], new_order[ids2pos[y.id]])) @@ -512,7 +512,7 @@ class ViewList(ParserView): try: rpc.execute('model', 'ir.ui.view_tree_width', 'set_width', self.screen.model_name, fields, rpc.CONTEXT) - except: + except Exception: pass self.widget_tree.destroy() del self.screen diff --git a/tryton/gui/window/view_form/view/list_gtk/parser.py b/tryton/gui/window/view_form/view/list_gtk/parser.py index 3334a67936..9f85717ecd 100644 --- a/tryton/gui/window/view_form/view/list_gtk/parser.py +++ b/tryton/gui/window/view_form/view/list_gtk/parser.py @@ -372,7 +372,7 @@ class Date(Char): return False try: date = datetime.date(*time.strptime(text, self.display_format)[:3]) - except: + except Exception: return False return common.datetime_strftime(date, self.server_format) @@ -399,7 +399,7 @@ class Datetime(Date): sdt = szone.localize(date, is_dst=True) ldt = sdt.astimezone(lzone) date = ldt - except: + except Exception: pass return common.datetime_strftime(date, self.display_format) @@ -409,7 +409,7 @@ class Datetime(Date): try: date = datetime.datetime(*time.strptime(text, self.display_format)[:6]) - except: + except Exception: return False if 'timezone' in rpc.CONTEXT: try: @@ -419,7 +419,7 @@ class Datetime(Date): ldt = lzone.localize(date, is_dst=True) sdt = ldt.astimezone(szone) date = sdt - except: + except Exception: pass return common.datetime_strftime(date, self.server_format) @@ -453,7 +453,7 @@ class Float(Char): def value_from_text(self, record, text): try: return locale.atof(text) - except: + except Exception: return 0.0 diff --git a/tryton/gui/window/view_form/widget_search/calendar.py b/tryton/gui/window/view_form/widget_search/calendar.py index 1c44b581c6..d07da18a7b 100644 --- a/tryton/gui/window/view_form/widget_search/calendar.py +++ b/tryton/gui/window/view_form/widget_search/calendar.py @@ -99,7 +99,7 @@ class Calendar(Interface): def _date_get(self, value): try: date = datetime.date(*time.strptime(value, self.format)[:3]) - except: + except Exception: return False if self.attrs.get('type', 'date') == 'datetime': return datetime_strftime(datetime.datetime.combine(date, @@ -139,7 +139,7 @@ class Calendar(Interface): return '' try: return datetime_strftime(value, self.format) - except: + except Exception: return '' i = self.liststore.get_iter_root() diff --git a/tryton/gui/window/view_form/widget_search/float.py b/tryton/gui/window/view_form/widget_search/float.py index 73144a8885..44dfe2891a 100644 --- a/tryton/gui/window/view_form/widget_search/float.py +++ b/tryton/gui/window/view_form/widget_search/float.py @@ -19,11 +19,11 @@ class Float(Integer): def _value_get(self): try: value1 = locale.atof(self.entry1.get_text()) - except: + except Exception: value1 = False try: value2 = locale.atof(self.entry2.get_text()) - except: + except Exception: value2 = False return self._get_clause(value1, value2) @@ -62,5 +62,5 @@ class Float(Integer): return if len(str(int(locale.atof(new_value)))) > self.digits[0]: widget.stop_emission('insert-text') - except: + except Exception: widget.stop_emission('insert-text') diff --git a/tryton/gui/window/view_form/widget_search/integer.py b/tryton/gui/window/view_form/widget_search/integer.py index 2b65eae0c5..9f4c94533e 100644 --- a/tryton/gui/window/view_form/widget_search/integer.py +++ b/tryton/gui/window/view_form/widget_search/integer.py @@ -63,11 +63,11 @@ class Integer(Interface): def _value_get(self): try: value1 = locale.atoi(self.entry1.get_text()) - except: + except Exception: value1 = False try: value2 = locale.atoi(self.entry2.get_text()) - except: + except Exception: value2 = False return self._get_clause(value1, value2) @@ -132,5 +132,5 @@ class Integer(Interface): if new_value == '-': return locale.atoi(new_value) - except: + except Exception: widget.stop_emission('insert-text') diff --git a/tryton/gui/window/view_tree/view_tree.py b/tryton/gui/window/view_tree/view_tree.py index 0a806669fa..f8aafc126c 100644 --- a/tryton/gui/window/view_tree/view_tree.py +++ b/tryton/gui/window/view_tree/view_tree.py @@ -86,7 +86,7 @@ class ViewTreeModel(gtk.GenericTreeModel, gtk.TreeSortable): sdt = szone.localize(obj[field], is_dst=True) ldt = sdt.astimezone(lzone) obj[field] = ldt - except: + except Exception: pass obj[field] = common.datetime_strftime(obj[field], display_format) @@ -105,7 +105,7 @@ class ViewTreeModel(gtk.GenericTreeModel, gtk.TreeSortable): 0, None, None, rpc.CONTEXT, ['rec_name']) selection = [(x['id'], x['rec_name']) for x in result] - except: + except Exception: selection = [] else: if not isinstance(self.fields_type[field]['selection'], @@ -115,7 +115,7 @@ class ViewTreeModel(gtk.GenericTreeModel, gtk.TreeSortable): self.view['model'], self.fields_type[field]['selection'], rpc.CONTEXT) - except: + except Exception: selection = [] self.fields_type[field]['selection'] = selection elif field_type in ('float', 'numeric'): @@ -320,7 +320,7 @@ class ViewTreeModel(gtk.GenericTreeModel, gtk.TreeSortable): return None tree = node[2] return (tuple(path), node) - except: + except Exception: return None class ViewTree(object): diff --git a/tryton/gui/window/win_import.py b/tryton/gui/window/win_import.py index 74c59b3882..b124af32a7 100644 --- a/tryton/gui/window/win_import.py +++ b/tryton/gui/window/win_import.py @@ -256,7 +256,7 @@ class WinImport(object): try: data = csv.reader(open(fname, 'rb'), quotechar=csvdel, delimiter=csvsep) - except: + except Exception: common.warning(_('Error opening CSV file'), self.dialog, _('Error')) return True diff --git a/tryton/gui/window/wizard.py b/tryton/gui/window/wizard.py index 25cf1aa0f4..6e412c9497 100644 --- a/tryton/gui/window/wizard.py +++ b/tryton/gui/window/wizard.py @@ -129,7 +129,7 @@ class Wizard(SignalEvent): rpc.execute('wizard', self.action, 'delete', self.wiz_id) #XXX to remove when company displayed in status bar rpc.context_reload() - except: + except Exception: pass Main.get_main()._win_del(self.widget) diff --git a/tryton/pysocket.py b/tryton/pysocket.py index b502baf1d0..60694beb5f 100644 --- a/tryton/pysocket.py +++ b/tryton/pysocket.py @@ -68,7 +68,7 @@ class PySocket: socket.SOCK_STREAM) self.sock.settimeout(CONNECT_TIMEOUT) self.sock.connect((host, int(port))) - except: + except Exception: self.sock = None if self.sock is None: self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -83,7 +83,7 @@ class PySocket: sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) sock.settimeout(CONNECT_TIMEOUT) sock.connect((host, int(port))) - except: + except Exception: sock = None if sock is None: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -95,7 +95,7 @@ class PySocket: elif hasattr(socket, 'ssl'): ssl_sock = socket.ssl(sock) self.ssl = True - except: + except Exception: pass self.sock.settimeout(TIMEOUT) if self.ssl: @@ -143,10 +143,10 @@ class PySocket: sock.sock_shutdown(shutdown_value) else: sock.shutdown(shutdown_value) - except: + except Exception: pass sock.close() - except: + except Exception: pass self.sock = None self.ssl = False diff --git a/tryton/rpc.py b/tryton/rpc.py index 3899fcdae8..96c3aba5fe 100644 --- a/tryton/rpc.py +++ b/tryton/rpc.py @@ -48,7 +48,7 @@ def db_list(host, port): _SEMAPHORE.release() logging.getLogger('rpc.result').debug(repr(res)) return res - except: + except Exception: logging.getLogger('rpc.result').debug(repr(None)) return None @@ -80,7 +80,7 @@ def db_exec(host, port, method, *args): _SEMAPHORE.release() logging.getLogger('rpc.result').debug(repr(res)) return res - except: + except Exception: raise def server_version(host, port): @@ -111,7 +111,7 @@ def server_version(host, port): _SEMAPHORE.release() logging.getLogger('rpc.result').debug(repr(res)) return res - except: + except Exception: logging.getLogger('rpc.result').debug(repr(None)) return None @@ -170,7 +170,7 @@ def logout(): logging.getLogger('rpc.result').debug(repr(res)) finally: _SEMAPHORE.release() - except: + except Exception: pass _SOCK.disconnect() _SOCK = None @@ -185,7 +185,7 @@ def context_reload(): global CONTEXT, TIMEZONE try: context = execute('model', 'res.user', 'get_preferences', True, {}) - except: + except Exception: return CONTEXT = {} for i in context: @@ -194,7 +194,7 @@ def context_reload(): if i == 'timezone': try: TIMEZONE = execute('common', None, 'timezone_get') - except: + except Exception: pass def _execute(blocking, *args): diff --git a/tryton/translate.py b/tryton/translate.py index 31590f8f8b..82726553db 100644 --- a/tryton/translate.py +++ b/tryton/translate.py @@ -177,7 +177,7 @@ def setlang(lang=None, locale_dict=None): os.environ['LC_MESSAGES'] = lang2 + '.' + encoding os.environ['LANG'] = lang + '.' + encoding locale.setlocale(locale.LC_ALL, str(lang2 + '.' + encoding)) - except: + except Exception: logging.getLogger('translate').info( _('Unable to set locale %s') % lang2 + '.' + encoding) diff --git a/tryton/wizard/main.py b/tryton/wizard/main.py index c553872269..8d0ab99672 100644 --- a/tryton/wizard/main.py +++ b/tryton/wizard/main.py @@ -131,7 +131,7 @@ class Dialog(object): rpc.execute('model', 'ir.action.wizard_size', 'set_size', self.action, self.screen.name, width, height, rpc.CONTEXT) - except: + except Exception: pass if res < len(self.states) and res >= 0: @@ -249,5 +249,5 @@ class Wizard(object): rpc.execute('wizard', action, 'delete', wiz_id) #XXX to remove when company displayed in status bar rpc.context_reload() - except: + except Exception: pass