author | Leandro Lucarella
<luca@llucax.com.ar> 2008-08-12 20:54:31 UTC |
committer | Leandro Lucarella
<luca@llucax.com.ar> 2008-08-25 18:05:19 UTC |
parent | 6fdc0e1a568f5e6103c9c965a15ddf7ff29a2e5f |
blitiri.cgi | +5 | -3 |
diff --git a/blitiri.cgi b/blitiri.cgi index c54480c..f9663b5 100755 --- a/blitiri.cgi +++ b/blitiri.cgi @@ -423,7 +423,7 @@ def validate_rst(rst): except SystemMessage, e: desc = e.args[0].encode('utf-8') # the error string desc = desc[9:] # remove "<string>:" - line = int(desc[:desc.find(':')]) # get just the line number + line = int(desc[:desc.find(':')] or 0) # get the line number desc = desc[desc.find(')')+2:-1] # remove (LEVEL/N) try: desc, context = desc.split('\n', 1) @@ -1136,8 +1136,10 @@ def handle_cgi(): error = validate_rst(form_data.body) if error is not None: (line, desc, ctx) = error - form_data.body_error = 'error at line %d: %s' \ - % (line, desc) + at = '' + if line: + at = ' at line %d' % line + form_data.body_error = 'error%s: %s' % (at, desc) valid = False if valid: c = article.add_comment(form_data.author,