19
20
self._manager.reactor.call_on("exchange", self.exchange)
21
22
def exchange(self):
23
message_store = self._manager.message_store
25
# 'field.date_created': u'2007-08-01',
26
# 'field.format': u'VERSION_1',
27
# 'field.private': u'',
28
# 'field.contactable': u'',
29
# 'field.livecd': u'',
30
# 'field.submission_id': u'unique ID 1',
31
# 'field.emailaddress': u'test@canonical.com',
32
# 'field.distribution': u'ubuntu',
33
# 'field.distrorelease': u'5.04',
34
# 'field.architecture': u'i386',
35
# 'field.system': u'HP 6543',
36
# 'field.submission_data': data,
37
# 'field.actions.upload': u'Upload'}
40
'field.date_created': u'2007-08-01',
41
'field.format': u'VERSION_1',
43
'field.contactable': u'',
45
'field.submission_id': message_store.get_secure_id(),
46
'field.emailaddress': u'test@canonical.com',
47
'field.distribution': u'ubuntu',
48
'field.distrorelease': u'5.04',
49
'field.architecture': u'i386',
50
'field.system': u'HP 6543',
51
'field.actions.upload': u'Upload'}
54
for k, v in fields.items():
55
form.append((k, v.encode("utf-8")))
22
58
payload = self.make_payload()
23
message_store = self._manager.message_store
24
59
spayload = bpickle.dumps(payload)
60
f = StringIO.StringIO(spayload)
62
f.size = len(spayload)
63
form.append(('field.submission_data', f))
25
65
if logging.getLogger().getEffectiveLevel() <= logging.DEBUG:
26
66
logging.debug("Sending payload:\n%s", pprint.pformat(payload))
27
ret = self._transport.exchange(spayload, message_store.get_secure_id())
67
ret = self._transport.exchange(form)
69
# XXX: fix beyond this point
29
72
# HACK: this should return a useful error message
30
73
self._manager.set_error("Invalid Secure ID or submission failure")