From e0828d8fdedfcd566af3cd750f390f9912eb77c9 Mon Sep 17 00:00:00 2001 From: Thomas Perl Date: Tue, 15 Jul 2008 08:09:18 +0000 Subject: [PATCH] Tue, 15 Jul 2008 10:08:16 +0200 Fix bugs and annoyances when no channels.opml file exists * src/gpodder/opml.py: Make sure can save a new channels.opml file when no other file exists, and make sure we don't try to parse a file that does not exist when opening OPML files git-svn-id: svn://svn.berlios.de/gpodder/trunk@775 b0d088ad-0a06-0410-aad2-9ed5178a7e87 --- ChangeLog | 7 +++++++ src/gpodder/opml.py | 10 +++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 579274c2..ef620cca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue, 15 Jul 2008 10:08:16 +0200 +Fix bugs and annoyances when no channels.opml file exists + + * src/gpodder/opml.py: Make sure can save a new channels.opml file + when no other file exists, and make sure we don't try to parse a file + that does not exist when opening OPML files + Tue, 15 Jul 2008 10:06:19 +0200 Do not hide podcast cover and pill pixbuf in podcast list by default diff --git a/src/gpodder/opml.py b/src/gpodder/opml.py index 6a0cdad3..de5caa2b 100644 --- a/src/gpodder/opml.py +++ b/src/gpodder/opml.py @@ -76,9 +76,13 @@ class Importer(object): """ self.items = [] try: - if os.path.exists( url): + if url.startswith('/'): # assume local filename - doc = xml.dom.minidom.parse( url) + if os.path.exists(url): + doc = xml.dom.minidom.parse( url) + else: + log('Empty/non-existing OPML file', sender=self) + return else: doc = xml.dom.minidom.parseString( self.read_url( url)) @@ -200,7 +204,7 @@ class Exporter(object): # try to save the new file, but keep the old one so we # don't end up with a clobbed, empty opml file. FREE_DISK_SPACE_AFTER = 1024*512 - if util.get_free_disk_space(self.filename) < 2*len(data)+FREE_DISK_SPACE_AFTER: + if util.get_free_disk_space(os.path.dirname(self.filename)) < 2*len(data)+FREE_DISK_SPACE_AFTER: log('Not enough free disk space to save channel list to %s', self.filename, sender = self) return False fp = open(self.filename+'.tmp', 'w')