Skip to content
Snippets Groups Projects
Commit 3e9b8d6b authored by nkour's avatar nkour
Browse files

enormous cleanup in untested code

parent 8bc51f53
No related branches found
No related tags found
No related merge requests found
......@@ -101,18 +101,14 @@ def write(self):
pass
self.__tempfile = os.path.join(base_dir, '.' + filename)
try:
fd = open(self.__tempfile, 'w')
except:
#chances are we cannot write file in a directory
err_str = _('Unable to write file in %s') % base_dir
print err_str
return err_str
f = open(self.__tempfile, 'w')
except IOError, e:
return str(e)
try:
gajim.config.foreach(self.write_line, fd)
except IOError, e:
fd.close()
return e.errno
fd.close()
return str(e)
f.close()
if os.path.exists(self.__filename):
# win32 needs this
try:
......@@ -122,7 +118,7 @@ def write(self):
try:
os.rename(self.__tempfile, self.__filename)
except IOError, e:
return e.errno
return str(e)
os.chmod(self.__filename, 0600)
def update_config(self, old_version, new_version):
......
......@@ -1204,19 +1204,18 @@ def process_connections(self):
gajim.mutex_events_for_ui.unlock()
time.sleep(0.01) # so threads in connection.py have time to run
return True # renew timeout (loop for ever)
except KeyboardInterrupt:
except KeyboardInterrupt: # FIXME: can this happen?? CTRL+C IS CATCHED BY SIGNAL
sys.exit()
return False
def save_config(self):
err_code = parser.write()
if err_code is not None:
strerr = os.strerror(err_code)
print strerr
err_str = parser.write()
if err_str is not None:
print >> sys.stderr, err_str
# it is good to notify the user
# in case he or she cannot see the output of the console
dialogs.ErrorDialog(_('Cannot save your preferences'),
strerr).get_response()
dialogs.ErrorDialog(_('Could not save your settings and preferences'),
err_str).get_response()
sys.exit(1)
def __init__(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment