def news_template(feed): global news_temp timeago = force_unicode(timesince(feed.create_date), "utf-8") tmp = news_temp[feed.news_type] tmp = force_unicode(tmp, "utf-8") tmp = tmp.replace('{{actioner}}', feed.actioner.username) tmp = tmp.replace('{{commit}}', feed.pull.merged_commit_hexsha[:10]) tmp = tmp.replace('{{to_head}}', feed.pull.to_head) tmp = tmp.replace('{{from_head}}', feed.pull.from_head) tmp = tmp.replace('{{time_ago}}', timeago) return tmp
def news_template(feed): global news_temp timeago = force_unicode(timesince(feed.create_date),"utf-8") tmp = news_temp[feed.news_type] tmp = force_unicode(tmp, "utf-8") tmp = tmp.replace('{{actioner}}', feed.actioner.username) tmp = tmp.replace('{{commit}}', feed.pull.merged_commit_hexsha[:10]) tmp = tmp.replace('{{to_head}}', feed.pull.to_head) tmp = tmp.replace('{{from_head}}', feed.pull.from_head) tmp = tmp.replace('{{time_ago}}', timeago) return tmp
def milestone_dueday(duedate): return timesince(duedate, future=True)