Philipp Hörist pushed to branch master at gajim / gajim

Commits:

2 changed files:

Changes:

  • gajim/common/optparser.py
    ... ... @@ -111,24 +111,18 @@ class OptionsParser:
    111 111
             (base_dir, filename) = os.path.split(self.__filename)
    
    112 112
             self.__tempfile = os.path.join(base_dir, '.' + filename)
    
    113 113
             try:
    
    114
    -            f = os.fdopen(os.open(self.__tempfile,
    
    115
    -                os.O_CREAT|os.O_WRONLY|os.O_TRUNC, 0o600), 'w', encoding='utf-8')
    
    114
    +            with open(self.__tempfile, 'w', encoding='utf-8') as f:
    
    115
    +                app.config.foreach(self.write_line, f)
    
    116 116
             except IOError as e:
    
    117 117
                 return str(e)
    
    118
    -        try:
    
    119
    -            app.config.foreach(self.write_line, f)
    
    120
    -        except IOError as e:
    
    121
    -            return str(e)
    
    122
    -        f.flush()
    
    123
    -        os.fsync(f.fileno())
    
    124
    -        f.close()
    
    118
    +
    
    125 119
             if os.path.exists(self.__filename):
    
    126 120
                 if os.name == 'nt':
    
    127 121
                     # win32 needs this
    
    128 122
                     try:
    
    129 123
                         os.remove(self.__filename)
    
    130
    -                except Exception:
    
    131
    -                    pass
    
    124
    +                except Exception as e:
    
    125
    +                    return str(e)
    
    132 126
             try:
    
    133 127
                 os.rename(self.__tempfile, self.__filename)
    
    134 128
             except IOError as e:
    

  • gajim/gui_interface.py
    ... ... @@ -2408,8 +2408,9 @@ class Interface:
    2408 2408
                 print(err_str, file=sys.stderr)
    
    2409 2409
                 # it is good to notify the user
    
    2410 2410
                 # in case he or she cannot see the output of the console
    
    2411
    -            dialogs.ErrorDialog(_('Could not save your settings and '
    
    2411
    +            error_dialog = dialogs.ErrorDialog(_('Could not save your settings and '
    
    2412 2412
                     'preferences'), err_str)
    
    2413
    +            error_dialog.run()
    
    2413 2414
                 sys.exit()
    
    2414 2415
     
    
    2415 2416
         @staticmethod