diff options
author | Mike Crute <mcrute@gmail.com> | 2010-02-15 19:19:47 -0500 |
---|---|---|
committer | Mike Crute <mcrute@gmail.com> | 2010-02-15 19:19:47 -0500 |
commit | 6ac707f8ab6ccc551bb0bf1a92aee4ce5329d4f3 (patch) | |
tree | 4e802b77086c7e7d78cd488b396c21cc6ecb2582 | |
parent | 8cfbd1b970870a0d2594e147cd9bcc223d0a33b9 (diff) | |
download | calendar_proxy-6ac707f8ab6ccc551bb0bf1a92aee4ce5329d4f3.tar.bz2 calendar_proxy-6ac707f8ab6ccc551bb0bf1a92aee4ce5329d4f3.tar.xz calendar_proxy-6ac707f8ab6ccc551bb0bf1a92aee4ce5329d4f3.zip |
Cleaning up syntactic crap
-rw-r--r-- | exchange/__init__.py | 4 | ||||
-rw-r--r-- | exchange/authenticators.py | 5 | ||||
-rw-r--r-- | exchange/commands.py | 5 | ||||
-rw-r--r-- | exchange/timezones.py | 5 | ||||
-rw-r--r-- | server.py | 38 |
5 files changed, 20 insertions, 37 deletions
diff --git a/exchange/__init__.py b/exchange/__init__.py index 429946a..a2a78ec 100644 --- a/exchange/__init__.py +++ b/exchange/__init__.py | |||
@@ -1,12 +1,10 @@ | |||
1 | # -*- coding: utf-8 -*- | 1 | # vim: set filencoding=utf8 |
2 | """ | 2 | """ |
3 | Exchange Server Handling Code | 3 | Exchange Server Handling Code |
4 | 4 | ||
5 | @author: Mike Crute (mcrute@gmail.com) | 5 | @author: Mike Crute (mcrute@gmail.com) |
6 | @organization: SoftGroup Interactive, Inc. | 6 | @organization: SoftGroup Interactive, Inc. |
7 | @date: April 26, 2009 | 7 | @date: April 26, 2009 |
8 | |||
9 | $Id$ | ||
10 | """ | 8 | """ |
11 | 9 | ||
12 | 10 | ||
diff --git a/exchange/authenticators.py b/exchange/authenticators.py index 12fb309..bcc2e38 100644 --- a/exchange/authenticators.py +++ b/exchange/authenticators.py | |||
@@ -1,13 +1,12 @@ | |||
1 | # -*- coding: utf-8 -*- | 1 | # vim: set filencoding=utf8 |
2 | """ | 2 | """ |
3 | Exchange Server Authenticators | 3 | Exchange Server Authenticators |
4 | 4 | ||
5 | @author: Mike Crute (mcrute@gmail.com) | 5 | @author: Mike Crute (mcrute@gmail.com) |
6 | @organization: SoftGroup Interactive, Inc. | 6 | @organization: SoftGroup Interactive, Inc. |
7 | @date: April 26, 2009 | 7 | @date: April 26, 2009 |
8 | |||
9 | $Id$ | ||
10 | """ | 8 | """ |
9 | |||
11 | import urllib | 10 | import urllib |
12 | 11 | ||
13 | from copy import copy | 12 | from copy import copy |
diff --git a/exchange/commands.py b/exchange/commands.py index 40446e2..8198ca6 100644 --- a/exchange/commands.py +++ b/exchange/commands.py | |||
@@ -1,4 +1,4 @@ | |||
1 | # -*- coding: utf-8 -*- | 1 | # vim: set filencoding=utf8 |
2 | """ | 2 | """ |
3 | Exchange Commands | 3 | Exchange Commands |
4 | 4 | ||
@@ -9,9 +9,8 @@ This is a set of classes that starts to define a set of classes for | |||
9 | fetching data using Exchange's WebDAV API. This is still pretty | 9 | fetching data using Exchange's WebDAV API. This is still pretty |
10 | development code but it does the trick. Watch out, it doesn't consider | 10 | development code but it does the trick. Watch out, it doesn't consider |
11 | many corner cases. | 11 | many corner cases. |
12 | |||
13 | $Id$ | ||
14 | """ | 12 | """ |
13 | |||
15 | import xml.etree.cElementTree as etree | 14 | import xml.etree.cElementTree as etree |
16 | 15 | ||
17 | from httplib import HTTPSConnection | 16 | from httplib import HTTPSConnection |
diff --git a/exchange/timezones.py b/exchange/timezones.py index eefbe8e..b570e7b 100644 --- a/exchange/timezones.py +++ b/exchange/timezones.py | |||
@@ -1,13 +1,12 @@ | |||
1 | # -*- coding: utf-8 -*- | 1 | # vim: set filencoding=utf8 |
2 | """ | 2 | """ |
3 | Timezone Definitions | 3 | Timezone Definitions |
4 | 4 | ||
5 | @author: Mike Crute (mcrute@gmail.com) | 5 | @author: Mike Crute (mcrute@gmail.com) |
6 | @organization: SoftGroup Interactive, Inc. | 6 | @organization: SoftGroup Interactive, Inc. |
7 | @date: April 26, 2009 | 7 | @date: April 26, 2009 |
8 | |||
9 | $Id$ | ||
10 | """ | 8 | """ |
9 | |||
11 | from datetime import tzinfo, timedelta | 10 | from datetime import tzinfo, timedelta |
12 | 11 | ||
13 | 12 | ||
@@ -1,13 +1,12 @@ | |||
1 | # -*- coding: utf-8 -*- | 1 | # vim: set filencoding=utf8 |
2 | """ | 2 | """ |
3 | Exchange Calendar Proxy Server | 3 | Exchange Calendar Proxy Server |
4 | 4 | ||
5 | @author: Mike Crute (mcrute@gmail.com) | 5 | @author: Mike Crute (mcrute@gmail.com) |
6 | @organization: SoftGroup Interactive, Inc. | 6 | @organization: SoftGroup Interactive, Inc. |
7 | @date: April 26, 2009 | 7 | @date: April 26, 2009 |
8 | |||
9 | $Id$ | ||
10 | """ | 8 | """ |
9 | |||
11 | from getpass import getpass | 10 | from getpass import getpass |
12 | from ConfigParser import ConfigParser | 11 | from ConfigParser import ConfigParser |
13 | from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | 12 | from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler |
@@ -17,6 +16,7 @@ from exchange.authenticators import CookieAuthenticator | |||
17 | 16 | ||
18 | 17 | ||
19 | class CalendarHandler(BaseHTTPRequestHandler): | 18 | class CalendarHandler(BaseHTTPRequestHandler): |
19 | |||
20 | def do_GET(self): | 20 | def do_GET(self): |
21 | print('* Fetching Calendars') | 21 | print('* Fetching Calendars') |
22 | 22 | ||
@@ -34,34 +34,22 @@ class CalendarHandler(BaseHTTPRequestHandler): | |||
34 | self.wfile.close() | 34 | self.wfile.close() |
35 | 35 | ||
36 | 36 | ||
37 | def get_un_pass(config): | ||
38 | username = config.get('exchange', 'user') | ||
39 | |||
40 | if config.has_option('exchange', 'password'): | ||
41 | password = config.get('exchange', 'password') | ||
42 | else: | ||
43 | password = getpass('Exchange Password: ') | ||
44 | |||
45 | return username, password | ||
46 | |||
47 | |||
48 | def get_host_port(config): | ||
49 | bind_address = config.get('local_server', 'address') | ||
50 | bind_port = int(config.get('local_server', 'port')) | ||
51 | |||
52 | return bind_address, bind_port | ||
53 | |||
54 | |||
55 | def main(config_file='exchange.cfg'): | 37 | def main(config_file='exchange.cfg'): |
56 | config = ConfigParser() | 38 | config = ConfigParser() |
57 | config.read(config_file) | 39 | config.read(config_file) |
58 | server_cfg = get_host_port(config) | 40 | bind_address = config.get('local_server', 'address') |
41 | bind_port = int(config.get('local_server', 'port')) | ||
59 | 42 | ||
60 | print('Exchange iCal Proxy Running on port {0:d}'.format(server_cfg[1])) | 43 | print('Exchange iCal Proxy Running on port {0:d}'.format(bind_port)) |
61 | 44 | ||
62 | server = HTTPServer(server_cfg, CalendarHandler) | 45 | server = HTTPServer((bind_address, bind_port), CalendarHandler) |
63 | server.exchange_server = config.get('exchange', 'server') | 46 | server.exchange_server = config.get('exchange', 'server') |
64 | server.user, server.password = get_un_pass(config) | 47 | server.user = config.get('exchange', 'user') |
48 | |||
49 | if config.has_option('exchange', 'password'): | ||
50 | server.password = config.get('exchange', 'password') | ||
51 | else: | ||
52 | server.password = getpass('Exchange Password: ') | ||
65 | 53 | ||
66 | try: | 54 | try: |
67 | server.serve_forever() | 55 | server.serve_forever() |