Kill Bartle's hybrid main.py
authorMichael Spang <mspang@csclub.uwaterloo.ca>
Wed, 9 Sep 2009 10:56:31 +0000 (06:56 -0400)
committerMichael Spang <mspang@csclub.uwaterloo.ca>
Wed, 9 Sep 2009 10:58:56 +0000 (06:58 -0400)
bin/ceo
ceo/main.py [deleted file]

diff --git a/bin/ceo b/bin/ceo
index 0a7e84f..6fae10e 100755 (executable)
--- a/bin/ceo
+++ b/bin/ceo
@@ -1,3 +1,39 @@
 #!/usr/bin/python
-import ceo.main
-ceo.main.start()
+
+import sys, ldap
+from getpass import getpass
+import ceo.urwid.main
+import ceo.console.main
+from ceo import ldapi, members, library
+
+def start():
+    try:
+        print "Reading config file...",
+        members.configure()
+        library.configure()
+
+        print "Connecting to LDAP..."
+        members.connect(AuthCallback())
+
+        if len(sys.argv) == 1:
+          ceo.urwid.main.start()
+        else:
+          ceo.console.main.start()
+    except ldap.LOCAL_ERROR, e:
+        print ldapi.format_ldaperror(e)
+    except ldap.INSUFFICIENT_ACCESS, e:
+        print ldapi.format_ldaperror(e)
+        print "You probably aren't permitted to do whatever you just tried."
+        print "Admittedly, ceo probably shouldn't have crashed either."
+
+class AuthCallback:
+    def callback(self, error):
+        try:
+            print "Password: ",
+            return getpass("")
+        except KeyboardInterrupt:
+            print ""
+            sys.exit(1)
+
+if __name__ == '__main__':
+    start()
diff --git a/ceo/main.py b/ceo/main.py
deleted file mode 100644 (file)
index 07a6c5d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-import sys, ldap
-from getpass import getpass
-import ceo.urwid.main
-import ceo.console.main
-from ceo import ldapi, members, library
-
-def start():
-    try:
-        print "Reading config file...",
-        #XXX this should really all be done through one big config file
-        members.configure()
-        library.configure() 
-        print "read."
-        
-        print "Connecting to LDAP..."
-        members.connect(AuthCallback())
-
-        if len(sys.argv) == 1:
-          ceo.urwid.main.start()
-        else:
-          ceo.console.main.start()
-    except ldap.LOCAL_ERROR, e:
-        print ldapi.format_ldaperror(e)
-    except ldap.INSUFFICIENT_ACCESS, e:
-        print ldapi.format_ldaperror(e)
-        print "You probably aren't permitted to do whatever you just tried."
-        print "Admittedly, ceo probably shouldn't have crashed either."
-
-class AuthCallback:
-    def callback(self, error):
-        try:
-            print "Password: ",
-            return getpass("")
-        except KeyboardInterrupt:
-            print ""
-            sys.exit(1)