~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to services/svnlogservice

  • Committer: David Coles
  • Date: 2010-07-27 04:52:14 UTC
  • Revision ID: coles.david@gmail.com-20100727045214-p32h1kc0gcv48dpr
Worksheets: Strip off whitespace from the end of exercise attempts.

This solves an issue where accidental whitespace in an attempt will cause 
"IndentationError" syntax error (which don't occur when run in console).

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import sys
29
29
import locale
30
30
 
31
 
try:
32
 
    import json
33
 
except ImportError:
34
 
    import simplejson as json
35
 
 
 
31
import cjson
36
32
import pysvn
37
33
 
38
34
import ivle.conf
47
43
    client.exception_style = 1
48
44
    logs = client.log(os.path.join('/home', sys.argv[1].decode('utf-8')),
49
45
                      discover_changed_paths=True)
50
 
    print json.dumps({'logs': [{'revno': log.revision.number,
51
 
                                'author': log.author.decode('utf-8'),
52
 
                                'message': log.message.decode('utf-8'),
53
 
                                'date': log.date,
54
 
                                'paths': [(p.path.decode('utf-8'), p.action)
55
 
                                          for p in log.changed_paths]}
56
 
                               for log in logs]})
 
46
    print cjson.encode({'logs': [{'revno': log.revision.number,
 
47
                                  'author': log.author.decode('utf-8'),
 
48
                                  'message': log.message.decode('utf-8'),
 
49
                                  'date': log.date,
 
50
                                  'paths': [(p.path.decode('utf-8'), p.action)
 
51
                                            for p in log.changed_paths]}
 
52
                                 for log in logs]})
57
53
except pysvn.ClientError, e:
58
54
    error = e[0]
59
55
 
72
68
    except IndexError:
73
69
        pass
74
70
 
75
 
    print json.dumps({'error': error})
 
71
    print cjson.encode({'error': error})