# 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
        """ post the piece """
        super(new,self).GET()

        post = web.input(_method="post",share=[])

        if self.cur_user:
            # get cur_user
            cur_user = self.cur_user

            # set user_id
            user_id = cur_user["id"]

            # set link
            if "link" in post:
                link = post["link"]
                url_parsed = urlparse(link)
                if not url_parsed.netloc: #相当于host
                    link = None
            else:
                link = None


            # set private
            private = "private" in post

            # set content
            content = post["content"]

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

# 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

        """ post the piece """
        super(new,self).GET()

        post = web.input(_method="post",share=[])

        if self.cur_user:
            # get cur_user
            cur_user = self.cur_user

            # set user_id
            user_id = cur_user["id"]

            # set link
            if "link" in post:
                link = post["link"]
                url_parsed = urlparse(link)
                if not url_parsed.netloc: #相当于host
                    link = None
            else:
                link = None


            # set private
            private = "private" in post

            # set content
            content = post["content"]

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

                return render.new(error)