~aaronp/software-center/reviews-tweaks

« back to all changes in this revision

Viewing changes to softwarecenter/backend/weblive_pristine.py

  • Committer: Aaron Peachey
  • Date: 2011-04-09 09:46:16 UTC
  • mfrom: (1439.1.254 software-center)
  • Revision ID: alpeachey@gmail.com-20110409094616-vewfzle488qdg3qk
mergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
        self.description = description
41
41
 
42
42
class WebLivePackage(object):
43
 
    def __init__(self, pkgname, version):
 
43
    def __init__(self, pkgname, version, autoinstall):
44
44
        self.pkgname = pkgname
45
45
        self.version = version
 
46
        self.autoinstall = autoinstall
46
47
 
47
48
class WebLiveServer(object):
48
 
    def __init__(self, name, title, description, timelimit, userlimit, users):
 
49
    def __init__(self, name, title, description, timelimit, userlimit, users, autoinstall):
49
50
        self.name = name
50
51
        self.title = title
51
52
        self.description = description
52
53
        self.timelimit = timelimit
53
54
        self.userlimit = userlimit
54
55
        self.current_users = users
 
56
        self.autoinstall = autoinstall
55
57
 
56
58
    def __repr__(self):
57
 
        return "[WebLiveServer: %s (%s - %s), timelimit=%s, userlimit=%s, current_users=%s" % (
58
 
            self.name, self.title, self.description, self.timelimit, self.userlimit, self.current_users)
 
59
        return "[WebLiveServer: %s (%s - %s), timelimit=%s, userlimit=%s, current_users=%s, autoinstall=%s" % (
 
60
            self.name, self.title, self.description, self.timelimit, self.userlimit, self.current_users, self.autoinstall)
59
61
 
60
62
class WebLiveEverythingServer(WebLiveServer):
61
 
    def __init__(self, name, title, description, timelimit, userlimit, users, locales, packages):
 
63
    def __init__(self, name, title, description, timelimit, userlimit, users, autoinstall, locales, packages):
62
64
        self.locales = [WebLiveLocale(x[0], x[1]) for x in locales]
63
 
        self.packages = [WebLivePackage(x[0], x[1]) for x in packages]
 
65
        self.packages = [WebLivePackage(x[0], x[1], x[2]) for x in packages]
64
66
 
65
 
        WebLiveServer.__init__(self, name, title, description, timelimit, userlimit, users)
 
67
        WebLiveServer.__init__(self, name, title, description, timelimit, userlimit, users, autoinstall)
66
68
 
67
69
    def __repr__(self):
68
 
        return "[WebLiveServer: %s (%s - %s), timelimit=%s, userlimit=%s, current_users=%s, nr_locales=%s, nr_pkgs=%s" % (
69
 
            self.name, self.title, self.description, self.timelimit, self.userlimit, self.current_users, len(self.locales), len(self.packages))
 
70
        return "[WebLiveServer: %s (%s - %s), timelimit=%s, userlimit=%s, current_users=%s, autoinstall=%s, nr_locales=%s, nr_pkgs=%s" % (
 
71
            self.name, self.title, self.description, self.timelimit, self.userlimit, self.current_users, self.autoinstall, len(self.locales), len(self.packages))
70
72
 
71
73
class WebLive:
72
74
    def __init__(self,url,as_object=False):
153
155
                    attr['timelimit'],
154
156
                    attr['userlimit'],
155
157
                    attr['users'],
 
158
                    attr['autoinstall'],
156
159
                    attr['locales'],
157
160
                    attr['packages']))
158
161
            return servers
172
175
        else:
173
176
            return [WebLiveLocale(x[0], x[1]) for x in reply['message']]
174
177
 
 
178
    def list_package_blacklist(self):
 
179
        query={}
 
180
        query['action']='list_package_blacklist'
 
181
        reply=self.do_query(query)
 
182
 
 
183
        if type(reply['message']) != type([]):
 
184
            raise WebLiveError("Invalid value, expected '%s' and got '%s'."
 
185
                % (type({}),type(reply['message'])))
 
186
 
 
187
        if not self.as_object:
 
188
            return reply['message']
 
189
        else:
 
190
            return [WebLivePackage(x, None, None) for x in reply['message']]
 
191
 
175
192
    def list_packages(self,serverid):
176
193
        query={}
177
194
        query['action']='list_packages'
185
202
        if not self.as_object:
186
203
            return reply['message']
187
204
        else:
188
 
            return [WebLivePackage(x[0], x[1]) for x in reply['message']]
 
205
            return [WebLivePackage(x[0], x[1], x[2]) for x in reply['message']]
189
206
 
190
207
    def list_servers(self):
191
208
        query={}
208
225
                    attr['description'],
209
226
                    attr['timelimit'],
210
227
                    attr['userlimit'],
211
 
                    attr['users']))
 
228
                    attr['users'],
 
229
                    attr['autoinstall']))
212
230
            return servers