def add_comment(self, sender, nick, message): sender_ref = api.actor_lookup_mobile(api.ROOT, sender) if not sender_ref: raise exception.ValidationError(HELP_SIGN_IN) logging.debug("comment: %s %s %s", nick, sender_ref.nick, message) nick = clean.nick(nick) stream_entry = api.reply_get_cache(sender=nick, target=sender_ref.nick, service='sms') if not stream_entry: # Well, or memcache timed it out... Or we crashed... Or... Or... raise exception.ValidationError( 'The message to which you tried to respond doesn\'t exist') api.entry_add_comment(sender_ref, entry=stream_entry.keyname(), content=message, nick=sender_ref.nick, stream=stream_entry.stream)
def add_comment(self, from_jid, nick, message): jid_ref = api.actor_lookup_im(api.ROOT, from_jid.base()) if not jid_ref: raise exception.ValidationError( "You must be signed in to post, please SIGN IN") logging.debug("comment: %s %s %s", nick, jid_ref.nick, message) nick = clean.nick(nick) stream_entry = api.reply_get_cache(sender=nick, target=jid_ref.nick, service='im') if not stream_entry: # Well, or memcache timed it out... Or we crashed... Or... Or... raise exception.ValidationError( 'The message to which you tried to respond doesn\'t exist') api.entry_add_comment(jid_ref, entry=stream_entry.keyname(), content=message, nick=jid_ref.nick, stream=stream_entry.stream)