From 8aaf9244116cf7e32666e7c22f891f3dba3a6e6b Mon Sep 17 00:00:00 2001 From: Brian Matherly Date: Mon, 15 Oct 2007 12:26:31 +0000 Subject: [PATCH] Create the directory if it doesn't exist for the web calendar. svn: r9190 --- ChangeLog | 3 +++ src/plugins/WebCal.py | 18 ++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 3a01c48d0..c39cdf8a0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-10-15 Brian Matherly + * src/plugins/WebCal.py: Create directory if it doesn't exist. + 2007-10-14 Don Allingham * src/GrampsDb/_GrampsBSDDB.py: fix gen calls diff --git a/src/plugins/WebCal.py b/src/plugins/WebCal.py index a449afbbe..fa275b451 100644 --- a/src/plugins/WebCal.py +++ b/src/plugins/WebCal.py @@ -446,6 +446,24 @@ class WebReport(Report): def write_report(self): """ The short method that runs through each month and creates a page. """ + if not os.path.isdir(self.html_dir): + parent_dir = os.path.dirname(self.html_dir) + if not os.path.isdir(parent_dir): + ErrorDialog(_("Neither %s nor %s are directories") % \ + (self.html_dir,parent_dir)) + return + else: + try: + os.mkdir(self.html_dir) + except IOError, value: + ErrorDialog(_("Could not create the directory: %s") % \ + self.html_dir + "\n" + value[1]) + return + except: + ErrorDialog(_("Could not create the directory: %s") % \ + self.html_dir) + return + # initialize the dict to fill: self.calendar = {} self.progress = Utils.ProgressMeter(_("Generate HTML calendars"),'')