Skip to content
Browse files

Fixed npe in subject

  • Loading branch information...
1 parent c3d6511 commit 20f6015e793dbe43c24409935fda27ed2d8ad258 Christoph Raschl committed May 22, 2013
Showing with 11 additions and 3 deletions.
  1. +11 −3 ews-fetch-calendar.py
View
14 ews-fetch-calendar.py
@@ -44,20 +44,28 @@ def format_orgmode_time(dateObj):
# Helper function to write an orgmode entry
def print_orgmode_entry(subject, start, end, location):
- print "* TODO " + subject.encode('ascii', 'ignore')
startDate = parse_ews_date(start);
endDate = parse_ews_date(end);
# Check if the appointment starts and ends on the same day and use proper formatting
+ dateStr = ""
if startDate.date() == endDate.date():
- print "<" + format_orgmode_date(startDate) + "-" + format_orgmode_time(endDate) + ">"
+ dateStr = "<" + format_orgmode_date(startDate) + "-" + format_orgmode_time(endDate) + ">"
else:
- print "<" + format_orgmode_date(startDate) + ">--<" + format_orgmode_date(endDate) + ">"
+ dateStr = "<" + format_orgmode_date(startDate) + ">--<" + format_orgmode_date(endDate) + ">"
+
+ if subject is not None:
+ if dateStr != "":
+ print "* TODO " + dateStr + " " + subject.encode('ascii', 'ignore')
+ else:
+ print "* TODO " + subject.encode('ascii', 'ignore')
if location is not None:
print ":PROPERTIES:"
print ":LOCATION: " + location.encode('utf-8')
print ":END:"
+ print ""
+
#Debug code
#print_orgmode_entry("subject", "2012-07-27T11:10:53Z", "2012-07-27T11:15:53Z", "location", "participants")
#exit(0)

0 comments on commit 20f6015

Please sign in to comment.
Something went wrong with that request. Please try again.