Browse Source

fixed events plugin to create output folder if missing

putro 4 months ago
parent
commit
aa0ebc7011
1 changed files with 5 additions and 2 deletions
  1. 5
    2
      plugins/events.py

+ 5
- 2
plugins/events.py View File

@@ -83,7 +83,7 @@ def parse_recursion(ev, field_name):
83 83
     freq = chunks[0].upper()
84 84
     if 'until' in chunks:
85 85
         until = datetime.strptime(chunks[-1], '%Y-%m-%d')
86
-        rrule = [freq, until] 
86
+        rrule = [freq, until]
87 87
     else:
88 88
         rrule = [freq]
89 89
     return rrule
@@ -126,6 +126,9 @@ def generate_ical_file(generator):
126 126
     if not ics_fname:
127 127
         return
128 128
 
129
+    if not os.path.exists(generator.settings['OUTPUT_PATH']):
130
+        os.makedirs(generator.settings['OUTPUT_PATH'])
131
+
129 132
     ics_fname = os.path.join(generator.settings['OUTPUT_PATH'], ics_fname)
130 133
     log.debug("Generating calendar at %s with %d events" % (ics_fname, len(events)))
131 134
 
@@ -148,7 +151,7 @@ def generate_ical_file(generator):
148 151
 
149 152
         ie = icalendar.Event(
150 153
             summary=e.metadata['title'],
151
-            dtstart=dtstart, 
154
+            dtstart=dtstart,
152 155
             dtend=dtend,
153 156
             dtstamp= dtstamp,
154 157
             priority=5,

Loading…
Cancel
Save