1
2 from twisted.spread import pb
3 from twisted.cred import credentials
4 from twisted.internet import reactor
5
8 self.user = user
9 self.host, self.port = master.split(":")
10 self.port = int(self.port)
11 self.num_changes = 0
12
13 - def send(self, branch, revision, comments, files, user=None, category=None, when=None):
14 if user is None:
15 user = self.user
16 change = {'who': user, 'files': files, 'comments': comments,
17 'branch': branch, 'revision': revision, 'category': category,
18 'when': when}
19 self.num_changes += 1
20
21 f = pb.PBClientFactory()
22 d = f.login(credentials.UsernamePassword("change", "changepw"))
23 reactor.connectTCP(self.host, self.port, f)
24 d.addCallback(self.addChange, change)
25 return d
26
31
33 if self.num_changes > 1:
34 print "%d changes sent successfully" % self.num_changes
35 elif self.num_changes == 1:
36 print "change sent successfully"
37 else:
38 print "no changes to send"
39
41 print "change(s) NOT sent, something went wrong:"
42 print why
43
44 - def stop(self, res):
47
50