diff options
author | Jasper St. Pierre <[email protected]> | 2012-05-01 18:00:54 -0400 |
---|---|---|
committer | Alexei Sorokin <[email protected]> | 2016-08-22 23:03:32 +0300 |
commit | 4561e25671a206408017a61c605228ca227ef03d (patch) | |
tree | d345f04d6b2e67e756b79de99adcca110512eb3b /Mozo/MenuEditor.py | |
parent | b9f9932db7d6583933c4c5c28e2f945b77c9548a (diff) | |
download | mozo-4561e25671a206408017a61c605228ca227ef03d.tar.bz2 mozo-4561e25671a206408017a61c605228ca227ef03d.tar.xz |
MenuEditor: remove regex madness
don't even.
Diffstat (limited to 'Mozo/MenuEditor.py')
-rw-r--r-- | Mozo/MenuEditor.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Mozo/MenuEditor.py b/Mozo/MenuEditor.py index 71a76eb..339279f 100644 --- a/Mozo/MenuEditor.py +++ b/Mozo/MenuEditor.py @@ -65,9 +65,8 @@ class MenuEditor: def save(self, from_loading=False): for menu in ('applications', 'settings'): - fd = open(getattr(self, menu).path, 'w') - fd.write(re.sub("\n[\s]*([^\n<]*)\n[\s]*</", "\\1</", getattr(self, menu).dom.toprettyxml().replace('<?xml version="1.0" ?>\n', ''))) - fd.close() + with open(getattr(self, menu).path, 'w') as f: + f.write(getattr(self, menu).dom.toprettyxml()) if not from_loading: self.__loadMenus() |