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

« back to all changes in this revision

Viewing changes to services/diffservice

  • Committer: William Grant
  • Date: 2010-07-28 05:06:15 UTC
  • Revision ID: grantw@unimelb.edu.au-20100728050615-uwbxn9frla3pdw8m
Encode content_type when downloading files. cjson made us write bad code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import sys
29
29
import locale
30
30
 
31
 
import cjson
 
31
try:
 
32
    import json
 
33
except ImportError:
 
34
    import simplejson as json
32
35
import pysvn
33
36
 
 
37
import ivle.conf
34
38
import ivle.svn
35
39
 
36
40
# Set locale to UTF-8
48
52
 
49
53
# Attempt to get the diff for these revisons
50
54
try:
51
 
    svnclient = pysvn.Client()
 
55
    svnclient = ivle.svn.create_auth_svn_client(username=ivle.conf.login,
 
56
                                                password=ivle.conf.svn_pass)
52
57
    svnclient.exception_style = 1
53
58
    diff = svnclient.diff
54
59
 
64
69
        revision1=revs[0],
65
70
        revision2=revs[1]
66
71
    )
67
 
    print cjson.encode({'diff': diff_text.decode('utf-8')})
 
72
    print json.dumps({'diff': diff_text.decode('utf-8')})
68
73
except pysvn.ClientError, e:
69
74
    error = e[0]
70
75
 
82
87
    except IndexError:
83
88
        pass
84
89
 
85
 
    print cjson.encode({'error': error})
 
90
    print json.dumps({'error': error})