Specify requests.post data as a dict

These were lists of pairs because we were going to repeat keys, but that didn't
work anyway.

(imported from commit 687b3f7b8a2821d057719c725f1f39db3992ae5c)
This commit is contained in:
Keegan McAllister
2012-11-13 16:21:17 -05:00
parent f82e8fc4d1
commit 42a5ea9d2e
2 changed files with 10 additions and 10 deletions

View File

@@ -493,11 +493,11 @@ def do_send_message(message, no_log=False):
# TODO: Reduce duplication in what we send. # TODO: Reduce duplication in what we send.
rendered = { 'text/html': message.to_dict(apply_markdown=True), rendered = { 'text/html': message.to_dict(apply_markdown=True),
'text/x-markdown': message.to_dict(apply_markdown=False) } 'text/x-markdown': message.to_dict(apply_markdown=False) }
requests.post(settings.TORNADO_SERVER + '/notify_new_message', data=[ requests.post(settings.TORNADO_SERVER + '/notify_new_message', data=dict(
('secret', settings.SHARED_SECRET), secret = settings.SHARED_SECRET,
('message', message.id), message = message.id,
('rendered', simplejson.dumps(rendered)), rendered = simplejson.dumps(rendered),
('users', ','.join(str(user.id) for user in recipients))]) users = ','.join(str(user.id) for user in recipients)))
class Subscription(models.Model): class Subscription(models.Model):
user_profile = models.ForeignKey(UserProfile) user_profile = models.ForeignKey(UserProfile)

View File

@@ -192,11 +192,11 @@ def update_pointer_backend(request, user_profile, updater, pointer=POST(converte
user_profile.save() user_profile.save()
if settings.TORNADO_SERVER: if settings.TORNADO_SERVER:
requests.post(settings.TORNADO_SERVER + '/notify_pointer_update', data=[ requests.post(settings.TORNADO_SERVER + '/notify_pointer_update', data=dict(
('secret', settings.SHARED_SECRET), secret = settings.SHARED_SECRET,
('user', user_profile.user.id), user = user_profile.user.id,
('new_pointer', pointer), new_pointer = pointer,
('pointer_updater', updater)]) pointer_updater = updater))
return json_success() return json_success()