Reviewers: ,
Please review this at http://codereview.tryton.org/591006/ Affected files: M tryton/common/common.py Index: tryton/common/common.py =================================================================== --- a/tryton/common/common.py +++ b/tryton/common/common.py @@ -112,10 +112,10 @@ ['name', 'icon'], rpc.CONTEXT) except TrytonServerError: icons = [] + fileno, path = tempfile.mkstemp() for icon in icons: # svg file cannot be loaded from data into a pixbuf - fileno, path = tempfile.mkstemp() - with os.fdopen(fileno, 'w') as svgfile: + with open(path, 'w') as svgfile: svgfile.write(icon['icon']) try: pixbuf = gtk.gdk.pixbuf_new_from_file(path.decode( @@ -123,12 +123,12 @@ except glib.GError: continue finally: - os.remove(path) self._tryton_icons.remove((icon['id'], icon['name'])) del self._name2id[icon['name']] self._loaded_icons.add(icon['name']) iconset = gtk.IconSet(pixbuf) self.add(icon['name'], iconset) + os.remove(path) ICONFACTORY = TrytonIconFactory() ICONFACTORY.add_default() -- [email protected] mailing list
