From 6ac707f8ab6ccc551bb0bf1a92aee4ce5329d4f3 Mon Sep 17 00:00:00 2001 From: Mike Crute Date: Mon, 15 Feb 2010 19:19:47 -0500 Subject: Cleaning up syntactic crap --- exchange/__init__.py | 4 +--- exchange/authenticators.py | 5 ++--- exchange/commands.py | 5 ++--- exchange/timezones.py | 5 ++--- 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 @@ -# -*- coding: utf-8 -*- +# vim: set filencoding=utf8 """ Exchange Server Handling Code @author: Mike Crute (mcrute@gmail.com) @organization: SoftGroup Interactive, Inc. @date: April 26, 2009 - -$Id$ """ 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 @@ -# -*- coding: utf-8 -*- +# vim: set filencoding=utf8 """ Exchange Server Authenticators @author: Mike Crute (mcrute@gmail.com) @organization: SoftGroup Interactive, Inc. @date: April 26, 2009 - -$Id$ """ + import urllib 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 @@ -# -*- coding: utf-8 -*- +# vim: set filencoding=utf8 """ Exchange Commands @@ -9,9 +9,8 @@ This is a set of classes that starts to define a set of classes for fetching data using Exchange's WebDAV API. This is still pretty development code but it does the trick. Watch out, it doesn't consider many corner cases. - -$Id$ """ + import xml.etree.cElementTree as etree 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 @@ -# -*- coding: utf-8 -*- +# vim: set filencoding=utf8 """ Timezone Definitions @author: Mike Crute (mcrute@gmail.com) @organization: SoftGroup Interactive, Inc. @date: April 26, 2009 - -$Id$ """ + from datetime import tzinfo, timedelta diff --git a/server.py b/server.py index cb101cd..0510b2b 100644 --- a/server.py +++ b/server.py @@ -1,13 +1,12 @@ -# -*- coding: utf-8 -*- +# vim: set filencoding=utf8 """ Exchange Calendar Proxy Server @author: Mike Crute (mcrute@gmail.com) @organization: SoftGroup Interactive, Inc. @date: April 26, 2009 - -$Id$ """ + from getpass import getpass from ConfigParser import ConfigParser from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler @@ -17,6 +16,7 @@ from exchange.authenticators import CookieAuthenticator class CalendarHandler(BaseHTTPRequestHandler): + def do_GET(self): print('* Fetching Calendars') @@ -34,34 +34,22 @@ class CalendarHandler(BaseHTTPRequestHandler): self.wfile.close() -def get_un_pass(config): - username = config.get('exchange', 'user') - - if config.has_option('exchange', 'password'): - password = config.get('exchange', 'password') - else: - password = getpass('Exchange Password: ') - - return username, password - - -def get_host_port(config): - bind_address = config.get('local_server', 'address') - bind_port = int(config.get('local_server', 'port')) - - return bind_address, bind_port - - def main(config_file='exchange.cfg'): config = ConfigParser() config.read(config_file) - server_cfg = get_host_port(config) + bind_address = config.get('local_server', 'address') + bind_port = int(config.get('local_server', 'port')) - print('Exchange iCal Proxy Running on port {0:d}'.format(server_cfg[1])) + print('Exchange iCal Proxy Running on port {0:d}'.format(bind_port)) - server = HTTPServer(server_cfg, CalendarHandler) + server = HTTPServer((bind_address, bind_port), CalendarHandler) server.exchange_server = config.get('exchange', 'server') - server.user, server.password = get_un_pass(config) + server.user = config.get('exchange', 'user') + + if config.has_option('exchange', 'password'): + server.password = config.get('exchange', 'password') + else: + server.password = getpass('Exchange Password: ') try: server.serve_forever() -- cgit v1.2.3