Esempio n. 1
0
def post_status(user, provider=None, msg=""):
    if msg and isinstance(msg, unicode):                                           
            msg = msg.encode("utf8") 
    if not provider or provider == config.OPENID_TYPE_DICT[config.OPENID_DOUBAN]:
        print "++++++++++post douban status"
        client = Douban.get_client(user.id)
        if client:
            if not msg:
                msg = "#thepast.me# 你好,旧时光| 我在用thepast, 广播备份,往事提醒,你也来试试吧 >> http://thepast.me "
            client.post_status(msg)

    if not provider or provider == config.OPENID_TYPE_DICT[config.OPENID_SINA]:
        print "++++++++++post sina status"
        client = SinaWeibo.get_client(user.id)
        if client:
            if not msg:
                msg = "#thepast.me# 你好,旧时光| 我在用thepast, 微博备份,往事提醒,你也来试试吧 >> http://thepast.me "
            client.post_status(msg)

    if not provider or provider == config.OPENID_TYPE_DICT[config.OPENID_TWITTER]:
        print "++++++++post twitter status"
        client = Twitter.get_client(user.id)
        if client:
            if not msg:
                msg = "#thepast.me# 你好,旧时光| 我在用thepast, twitter备份,往事提醒,你也来试试吧 >> http://thepast.me "
            client.post_status(msg)

    if not provider or provider == config.OPENID_TYPE_DICT[config.OPENID_QQ]:
        print "++++++++post qq weibo status"
        client = QQWeibo.get_client(user.id)
        if client:
            if not msg:
                msg = "#thepast.me# 你好,旧时光| 我在用thepast, 微博备份,往事提醒,你也来试试吧 >> http://thepast.me "
            client.post_status(msg)
Esempio n. 2
0
def post_status(user, provider=None, msg=""):
    if msg and isinstance(msg, unicode):
        msg = msg.encode("utf8")
    if not provider or provider == config.OPENID_TYPE_DICT[
            config.OPENID_DOUBAN]:
        print "++++++++++post douban status"
        client = Douban.get_client(user.id)
        if client:
            if not msg:
                msg = "#thepast.me# 你好,旧时光| 我在用thepast, 广播备份,往事提醒,你也来试试吧 >> http://thepast.me "
            client.post_status(msg)

    if not provider or provider == config.OPENID_TYPE_DICT[config.OPENID_SINA]:
        print "++++++++++post sina status"
        client = SinaWeibo.get_client(user.id)
        if client:
            if not msg:
                msg = "#thepast.me# 你好,旧时光| 我在用thepast, 微博备份,往事提醒,你也来试试吧 >> http://thepast.me "
            client.post_status(msg)

    if not provider or provider == config.OPENID_TYPE_DICT[
            config.OPENID_TWITTER]:
        print "++++++++post twitter status"
        client = Twitter.get_client(user.id)
        if client:
            if not msg:
                msg = "#thepast.me# 你好,旧时光| 我在用thepast, twitter备份,往事提醒,你也来试试吧 >> http://thepast.me "
            client.post_status(msg)

    if not provider or provider == config.OPENID_TYPE_DICT[config.OPENID_QQ]:
        print "++++++++post qq weibo status"
        client = QQWeibo.get_client(user.id)
        if client:
            if not msg:
                msg = "#thepast.me# 你好,旧时光| 我在用thepast, 微博备份,往事提醒,你也来试试吧 >> http://thepast.me "
            client.post_status(msg)