Fixed view command
authorDmitriy Morozov <dmitriy@mrzv.org>
Wed, 13 May 2009 11:37:54 -0700
changeset 21 ecb80f4fd3ec
parent 20 adb636ec4517
child 22 7909d4619017
Fixed view command
alexandria.py
--- a/alexandria.py	Fri May 08 17:45:56 2009 -0700
+++ b/alexandria.py	Wed May 13 11:37:54 2009 -0700
@@ -47,9 +47,9 @@
         self.commonpath = os.path.expanduser(config.get('paths', 'common'))
         
         try:
-            default_viewer = config.get('setup', 'viewer')
+            self.default_viewer = config.get('setup', 'viewer')
         except:
-            default_viewer = 'acroread'
+            self.default_viewer = 'acroread'
 
     def get_optparser(self):
         parser = Cmdln.get_optparser(self)
@@ -116,7 +116,6 @@
            ${cmd_option_list}
         """
 
-        if len(args) < 1: return
         p = Paper.query.filter(Paper.md5.startswith(hash)).all()
         if not p: 
             print self._colorize_string('error', 'No such paper')
@@ -126,7 +125,7 @@
             return
         else:
             p = p[0]
-        if not viewer: viewer = default_viewer
+        if not viewer: viewer = self.default_viewer
         os.system('%s %s' % (viewer, os.path.join(self.commonpath, p.path.strip('/'))))
     
     def do_remove(self, subcmd, options, hash):