From 4561e25671a206408017a61c605228ca227ef03d Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Tue, 1 May 2012 18:00:54 -0400 Subject: MenuEditor: remove regex madness don't even. --- Mozo/MenuEditor.py | 5 ++--- 1 file 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]*\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() -- cgit v1.2.1