Skip to content

Instantly share code, notes, and snippets.

@JshWright
Created May 28, 2010 18:15
Show Gist options
  • Save JshWright/417508 to your computer and use it in GitHub Desktop.
Save JshWright/417508 to your computer and use it in GitHub Desktop.
def send_message(sender, instance, **kwargs):
cmd = [{'cmd': 'inlinepush',
'params': {
'password': settings.APE_PASSWORD,
'raw': 'postmsg',
'channel': 'messages',
'data': {
'msg': instance.msg,
'posted_by': instance.posted_by,
'timestamp': str(instance.timestamp)
}
}
}]
url = settings.APE_SERVER + urllib2.quote(json.dumps(cmd))
response = urllib2.urlopen(url)
models.signals.post_save.connect(send_message, sender=Message)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment