def convert_message(self, m): if m.get("updateContent") and m["updateContent"]["person"].get('currentShare') and m["updateContent"]["person"]["currentShare"].get('comment'): m["display_text"] = utils.escape_html(m["updateContent"]["person"]["currentShare"]["comment"]) m["display_text"] = utils.replace_link(m["display_text"], "http://twitter.com/") if m.get('comment'): m["display_text"] = utils.escape_html(m["comment"]) m["display_text"] = utils.replace_link(m["display_text"], "http://twitter.com/") if m.get("updateComments") and m["updateComments"].get("_total") > 0: for c in m["updateComments"].get("values"): self.convert_message(c) return m
def convert_message(self, m): if m.get("updateContent") and m["updateContent"]["person"].get( 'currentShare' ) and m["updateContent"]["person"]["currentShare"].get('comment'): m["display_text"] = utils.escape_html( m["updateContent"]["person"]["currentShare"]["comment"]) m["display_text"] = utils.replace_link(m["display_text"], "http://twitter.com/") if m.get('comment'): m["display_text"] = utils.escape_html(m["comment"]) m["display_text"] = utils.replace_link(m["display_text"], "http://twitter.com/") if m.get("updateComments") and m["updateComments"].get("_total") > 0: for c in m["updateComments"].get("values"): self.convert_message(c) return m
def get_messages(self, account, url): user = self.session.get_user() response, content = oauth.CybozuliveHandler.request(user, account, url) if response["status"] != "200": raise Exception(response["status"] + " failed to get messages. : " + url) result = feedparser.parse(content) messages = [] for entry in result.entries: messages.append({ "id": entry.id, "title": entry.title, "link": entry.link, "author": entry.author, "summary": re.sub("\n", '<br/>', utils.escape_html(entry.summary)) if hasattr(entry, "summary") else "", "updated": datetime.datetime( *entry.updated_parsed[:6]).strftime("%a %b %d %H:%M:%S %Y") }) template_values = { 'service': 'cybozulive', "title": result.feed.title, "link": result.feed.link, "feed_url": url, 'messages': messages } return template_values
def build_entry(self, entry, room_id): entry["display_text"] = utils.escape_html(entry["content"]) entry["display_text"] = utils.replace_link( entry["display_text"], "https://www.youroom.in/r/%s/participations/" % room_id ) displayTime = utils.get_display_time(entry["created_at"], "%Y-%m-%dT%H:%M:%SZ") entry["display_time"] = displayTime return entry
def build_entry(self, entry, room_id): entry["display_text"] = utils.escape_html(entry["content"]) entry["display_text"] = utils.replace_link( entry["display_text"], "https://www.youroom.in/r/%s/participations/" % room_id) displayTime = utils.get_display_time(entry["created_at"], "%Y-%m-%dT%H:%M:%SZ") entry["display_time"] = displayTime return entry
def convert_message(self, m): if m.get("message"): m["display_text"] = utils.escape_html(m.get("message")) m["display_text"] = utils.replace_link(m["display_text"], "http://www.facebook.com/") m["display_time"] = utils.get_display_time(m.get("created_time"), "%Y-%m-%dT%H:%M:%S+0000"); if m.get("comments") and m["comments"].get("data"): for c in m["comments"]["data"]: c = self.convert_message(c) return m
def convert_messages(self, messages, users, threads, account): for m in messages : m["display_text"] = utils.escape_html(m["body"]["plain"]) m["display_text"] = utils.replace_link(m["display_text"], "https://www.yammer.com/%s/users/" % account) displayTime = utils.get_display_time(m["created_at"], "%Y/%m/%d %H:%M:%S +0000") m["display_time"] = displayTime #m["sender"] = self.get_user(account, m["sender_id"]) or m["sender_id"] m["sender"] = users.get(m["sender_id"]) or m["sender_id"] m["refs"] = threads.get(m["id"]) return messages
def convert_message(self, m): if m.get("message"): m["display_text"] = utils.escape_html(m.get("message")) m["display_text"] = utils.replace_link(m["display_text"], "http://www.facebook.com/") m["display_time"] = utils.get_display_time(m.get("created_time"), "%Y-%m-%dT%H:%M:%S+0000") if m.get("comments") and m["comments"].get("data"): for c in m["comments"]["data"]: c = self.convert_message(c) return m
def convert_message(self, m): body = m.get("Body") or m.get("CommentBody") if body: m["display_text"] = utils.escape_html(body) m["display_text"] = utils.replace_link(m["display_text"], "http://www.facebook.com/") time = m.get("LastModifiedDate") if m.get("LastModifiedDate") else m.get("CreatedDate") if time: try: m["display_time"] = utils.get_display_time(time, "%Y-%m-%dT%H:%M:%S.000Z") except: m["display_time"] = utils.get_display_time(time, "%Y-%m-%dT%H:%M:%S.000+0000") if m.get("FeedComments") and m["FeedComments"].get("totalSize") > 0: for c in m["FeedComments"].get("records"): self.convert_message(c) # if m.get("comments") and m["comments"].get("data"): # for c in m["comments"]["data"]: # c = self.convert_message(c) return m
def convert_message(self, m): body = m.get("Body") or m.get("CommentBody") if body: m["display_text"] = utils.escape_html(body) m["display_text"] = utils.replace_link(m["display_text"], "http://www.facebook.com/") time = m.get("LastModifiedDate") if m.get( "LastModifiedDate") else m.get("CreatedDate") if time: try: m["display_time"] = utils.get_display_time( time, "%Y-%m-%dT%H:%M:%S.000Z") except: m["display_time"] = utils.get_display_time( time, "%Y-%m-%dT%H:%M:%S.000+0000") if m.get("FeedComments") and m["FeedComments"].get("totalSize") > 0: for c in m["FeedComments"].get("records"): self.convert_message(c) #if m.get("comments") and m["comments"].get("data"): # for c in m["comments"]["data"]: # c = self.convert_message(c) return m
def get_messages(self, account, url): user = self.session.get_user() response, content = oauth.CybozuliveHandler.request(user, account, url) if response["status"] != "200": raise Exception(response["status"] + " failed to get messages. : " + url) result = feedparser.parse(content) messages = [] for entry in result.entries: messages.append({ "id": entry.id, "title": entry.title, "link": entry.link, "author": entry.author, "summary": re.sub("\n", '<br/>', utils.escape_html(entry.summary)) if hasattr(entry, "summary") else "", "updated": datetime.datetime(*entry.updated_parsed[:6]).strftime("%a %b %d %H:%M:%S %Y") }) template_values = { 'service': 'cybozulive', "title": result.feed.title, "link": result.feed.link, "feed_url": url, 'messages': messages } return template_values