summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hgignore2
-rw-r--r--exchange/commands.py6
-rw-r--r--server.py11
3 files changed, 14 insertions, 5 deletions
diff --git a/.hgignore b/.hgignore
new file mode 100644
index 0000000..2c9154d
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,2 @@
1syntax: glob
2*.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
22from icalendar import Calendar, Event, Alarm 22from icalendar import Calendar, Event, Alarm
23 23
24from exchange import ExchangeException 24from exchange import ExchangeException
25from exchange.timezones import EST
25 26
26 27
27class ExchangeCommand(object): 28class ExchangeCommand(object):
@@ -95,12 +96,13 @@ class FetchCalendar(ExchangeCommand):
95 96
96 sql = """ 97 sql = """
97 SELECT 98 SELECT
99 PidLidAllAttendeesString AS attendees,
98 "urn:schemas:calendar:location" AS location, 100 "urn:schemas:calendar:location" AS location,
101 "urn:schemas:calendar:organizer" AS organizer,
102 "urn:schemas:calendar:meetingstatus" AS status,
99 "urn:schemas:httpmail:normalizedsubject" AS subject, 103 "urn:schemas:httpmail:normalizedsubject" AS subject,
100 "urn:schemas:calendar:dtstart" AS start_date, 104 "urn:schemas:calendar:dtstart" AS start_date,
101 "urn:schemas:calendar:dtend" AS end_date, 105 "urn:schemas:calendar:dtend" AS end_date,
102 "urn:schemas:calendar:busystatus" AS busy_status,
103 "urn:schemas:calendar:instancetype" AS instance_type,
104 "urn:schemas:calendar:timezone" AS timezone_info, 106 "urn:schemas:calendar:timezone" AS timezone_info,
105 "urn:schemas:httpmail:textdescription" AS description 107 "urn:schemas:httpmail:textdescription" AS description
106 FROM 108 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
18 18
19class CalendarHandler(BaseHTTPRequestHandler): 19class CalendarHandler(BaseHTTPRequestHandler):
20 def do_GET(self): 20 def do_GET(self):
21 print('> GET CALENDARS') 21 print('* Fetching Calendars')
22 22
23 fetcher = FetchCalendar(self.server.exchange_server) 23 fetcher = FetchCalendar(self.server.exchange_server)
24 authenticator = CookieAuthenticator(self.server.exchange_server) 24 authenticator = CookieAuthenticator(self.server.exchange_server)
@@ -27,7 +27,11 @@ class CalendarHandler(BaseHTTPRequestHandler):
27 fetcher.authenticator = authenticator 27 fetcher.authenticator = authenticator
28 28
29 calendar = fetcher.execute() 29 calendar = fetcher.execute()
30 self.wfile.write(calendar.as_string()).close() 30 self.wfile.write(calendar.as_string())
31
32 # This seems to work on Linux but not Mac OS. ~mcrute
33 if hasattr(self.wfile, 'close'):
34 self.wfile.close()
31 35
32 36
33def get_un_pass(config): 37def get_un_pass(config):
@@ -49,7 +53,8 @@ def get_host_port(config):
49 53
50 54
51def main(config_file='exchange.cfg'): 55def main(config_file='exchange.cfg'):
52 config = ConfigParser().read(config_file) 56 config = ConfigParser()
57 config.read(config_file)
53 server_cfg = get_host_port(config) 58 server_cfg = get_host_port(config)
54 59
55 print('Exchange iCal Proxy Running on port {0:d}'.format(server_cfg[1])) 60 print('Exchange iCal Proxy Running on port {0:d}'.format(server_cfg[1]))