From 8cfbd1b970870a0d2594e147cd9bcc223d0a33b9 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Sun, 26 Apr 2009 18:57:09 -0400 Subject: Cleaning up some of the testing code. --- .hgignore | 2 ++ exchange/commands.py | 6 ++++-- server.py | 11 ++++++++--- 3 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 .hgignore diff --git a/.hgignore b/.hgignore new file mode 100644 index 0000000..2c9154d --- /dev/null +++ b/.hgignore @@ -0,0 +1,2 @@ +syntax: glob +*.pyc diff --git a/exchange/commands.py b/exchange/commands.py index 89db579..40446e2 100644 --- a/exchange/commands.py +++ b/exchange/commands.py @@ -22,6 +22,7 @@ import dateutil.parser from icalendar import Calendar, Event, Alarm from exchange import ExchangeException +from exchange.timezones import EST class ExchangeCommand(object): @@ -95,12 +96,13 @@ class FetchCalendar(ExchangeCommand): sql = """ SELECT + PidLidAllAttendeesString AS attendees, "urn:schemas:calendar:location" AS location, + "urn:schemas:calendar:organizer" AS organizer, + "urn:schemas:calendar:meetingstatus" AS status, "urn:schemas:httpmail:normalizedsubject" AS subject, "urn:schemas:calendar:dtstart" AS start_date, "urn:schemas:calendar:dtend" AS end_date, - "urn:schemas:calendar:busystatus" AS busy_status, - "urn:schemas:calendar:instancetype" AS instance_type, "urn:schemas:calendar:timezone" AS timezone_info, "urn:schemas:httpmail:textdescription" AS description FROM diff --git a/server.py b/server.py index b05fdb5..cb101cd 100644 --- a/server.py +++ b/server.py @@ -18,7 +18,7 @@ from exchange.authenticators import CookieAuthenticator class CalendarHandler(BaseHTTPRequestHandler): def do_GET(self): - print('> GET CALENDARS') + print('* Fetching Calendars') fetcher = FetchCalendar(self.server.exchange_server) authenticator = CookieAuthenticator(self.server.exchange_server) @@ -27,7 +27,11 @@ class CalendarHandler(BaseHTTPRequestHandler): fetcher.authenticator = authenticator calendar = fetcher.execute() - self.wfile.write(calendar.as_string()).close() + self.wfile.write(calendar.as_string()) + + # This seems to work on Linux but not Mac OS. ~mcrute + if hasattr(self.wfile, 'close'): + self.wfile.close() def get_un_pass(config): @@ -49,7 +53,8 @@ def get_host_port(config): def main(config_file='exchange.cfg'): - config = ConfigParser().read(config_file) + config = ConfigParser() + config.read(config_file) server_cfg = get_host_port(config) print('Exchange iCal Proxy Running on port {0:d}'.format(server_cfg[1])) -- cgit v1.2.3