--- a/alexandria.py Thu May 07 22:54:28 2009 -0700
+++ b/alexandria.py Fri May 08 17:45:56 2009 -0700
@@ -37,10 +37,19 @@
class Alexandria(Cmdln):
name = 'alexandria'
- def __init__(self, commonpath, dbpath):
+ def __init__(self):
Cmdln.__init__(self)
- self.commonpath = commonpath
- self.dbpath = dbpath
+
+ # Parse config
+ config = SafeConfigParser()
+ config.read([os.path.expanduser('~/.alexandria')])
+ self.dbpath = os.path.expanduser(config.get('paths', 'dbpath'))
+ self.commonpath = os.path.expanduser(config.get('paths', 'common'))
+
+ try:
+ default_viewer = config.get('setup', 'viewer')
+ except:
+ default_viewer = 'acroread'
def get_optparser(self):
parser = Cmdln.get_optparser(self)
@@ -49,7 +58,7 @@
def postoptparse(self):
# Find database
- found, path = find_database(self.options.database or dbpath)
+ found, path = find_database(self.options.database or self.dbpath)
initDatabase(path, not found)
@@ -345,17 +354,5 @@
if __name__ == "__main__":
- # Parse config
- config = SafeConfigParser()
- config.read([os.path.expanduser('~/.alexandria')])
- dbpath = os.path.expanduser(config.get('paths', 'dbpath'))
- commonpath = os.path.expanduser(config.get('paths', 'common'))
-
- try:
- default_viewer = config.get('setup', 'viewer')
- except:
- default_viewer = 'acroread'
-
-
- alexandria = Alexandria(commonpath, dbpath)
+ alexandria = Alexandria()
sys.exit(alexandria.main())