Commits

Benoît Allard  committed 5a30d0a

api: Accept empty line in diffs, fix issue57

  • Participants
  • Parent commits bf2c746

Comments (0)

Files changed (2)

File review/api.py

             for n, line in enumerate(d):
                 start = n - context if n > context else 0
                 end = n + context + 1
-                if any(filter(lambda l: l[0] in '+-', d[start:end])):
+                if any(filter(lambda l: l and l[0] in '+-', d[start:end])):
                     yield (n, line)
 
         for filename, content in ds.iteritems():

File review/web.py

     return 'http://www.gravatar.com/avatar/%s?s=%d' % (md5(email(cset.user())).hexdigest(), size)
 
 def _line_type(line):
-    return 'rem' if line[0] == '-' else 'add' if line[0] == '+' else 'con'
+    try:
+        return {'+': 'add', '-':'rem'}[line[0]]
+    except (IndexError, KeyError):
+        return 'con'
 
 def _categorize_signoffs(signoffs):
     return { 'yes': len(filter(lambda s: s.opinion == 'yes', signoffs)),