--- a/alexandria.py Sat Jul 12 12:00:53 2008 -0400
+++ b/alexandria.py Mon Jul 14 12:56:57 2008 -0400
@@ -71,8 +71,13 @@
def view(args, options):
"""view paper by hash"""
if len(args) < 1: return
- p = Paper.query.filter(Paper.md5.startswith(args[0])).one()
+ p = Paper.query.filter(Paper.md5.startswith(args[0])).all()
if not p: return
+ if len(p) > 1:
+ print _colorize_string('error', 'Too many choices')
+ return
+ else:
+ p = p[0]
if len(args) > 1: viewer = args[1]
else: viewer = default_viewer
os.system('%s %s' % (viewer, os.path.join(options.commonpath, p.path.strip('/'))))
@@ -216,7 +221,7 @@
print a.nicknames[-1]
def _sort_authors(authors):
- authors.sort() # FIXME: deal with firstname lastname issues
+ authors.sort(lambda x,y: cmp(x.split()[-1], y.split()[-1]))
def _show_paper(paper):
print _colorize_string('title', paper.title)