# Path: config/setting.py

# 
# Path: util/oauth.py
# class weibo(oauthbase):
# class douban(oauthbase):
#     def get_current_user_info(self,access_token):
#     def post(self,content):
#     def get_current_user_info(self,access_token):
#     def post(self,content):
# def createClientWithName(name,user=None):


from config.setting import render
from util import oauth
from base import base
        from model import piece
        from urlparse import urlparse
import web


            # set private
            private = "private" in post

            # set content
            content = post["content"]

            if content.strip() == "":
                error = "内容不能为空"
                return render.new(error)

            if "pics" in post:
                pics = post["pics"]
            else:
                pics = None

            # insert
            piece_id = piece.add(user_id=user_id,content=content,link=link,private=private,pics=pics)

            # share
            if not private:
                share = post["share"]
                content = sliceContent(content)
                share_content = u"「" + content + u"」" + " http://" + web.ctx.host + "/piece/" + str(piece_id)
                if "weibo" in share:
                    client = oauth.createClientWithName("weibo",cur_user)
                    client.post(share_content)

                if "douban" in share:

# Path: config/setting.py

# 
# Path: util/oauth.py
# class weibo(oauthbase):
# class douban(oauthbase):
#     def get_current_user_info(self,access_token):
#     def post(self,content):
#     def get_current_user_info(self,access_token):
#     def post(self,content):
# def createClientWithName(name,user=None):


# Path: controller/page/new.py
from config.setting import render
from util import oauth
from base import base
        from model import piece
        from urlparse import urlparse
import web



            # set private
            private = "private" in post

            # set content
            content = post["content"]

            if content.strip() == "":
                error = "内容不能为空"
                return render.new(error)

            if "pics" in post:
                pics = post["pics"]
            else:
                pics = None

            # insert
            piece_id = piece.add(user_id=user_id,content=content,link=link,private=private,pics=pics)

            # share
            if not private:
                share = post["share"]
                content = sliceContent(content)
                share_content = u"「" + content + u"」" + " http://" + web.ctx.host + "/piece/" + str(piece_id)
                if "weibo" in share:
                    client = oauth.createClientWithName("weibo",cur_user)
                    client.post(share_content)

                if "douban" in share:

                    client = oauth.createClientWithName("douban",cur_user)