示例#1
0
    def GET(self, username, p=1):
        u = users.get_user_by_username(username)
        print user

        if u:
            page = int(p)
            perpage = 5
            offset = (page - 1) * perpage

            created_posts = postModel.getCreatedPostsByUserId(u.id, offset, perpage).list()

            nodes = []
            for i in xrange(len(created_posts)):
                nodes += nodeModel.getNodesByNodeId(created_posts[i].nodeId)

            #得到资料
            profile = users.get_profile_by_user_id(u.id)

            #是否登录,
            if user.is_logged:
                per = users.get_permission_by_douid(user.douban_id)
                rights = per[0].rights
                #得到提醒
                notification_results, notification_num = notification.get_unread_notification(user.id)
                #得到@提醒
                notification_mention_results, mention_num= notification.get_unread_metion_notifition(user.id)
                #链表 得到提醒的详细id\名称等
                ntf_posts = []
                ntf_users = []
                mtf_posts = []
                mtf_users = []

                ntf_list = notification_results.list()
                mtf_list = notification_mention_results.list()
                for x in xrange(len(ntf_list)):
                    ntf_posts += postModel.getPostsByPostId(ntf_list[x].pid)
                    ntf_users += users.get_users_by_id(ntf_list[x].uid)

                for x in xrange(len(mtf_list)):
                    mtf_posts += postModel.getPostsByPostId(mtf_list[x].pid)
                    mtf_users += users.get_users_by_id(mtf_list[x].uid)

                ntf_list = ntf_list + mtf_list
                ntf_posts = ntf_posts + mtf_posts
                ntf_users = ntf_users + mtf_users
                notification_num = notification_num+mention_num

            else:
                rights = 0
                is_voted = None
                notification_results = None
                notification_num = None
                ntf_list = None
                ntf_posts = None
                ntf_users = None
                
            return view.base(view.member_home(u, profile, created_posts, nodes, user), user, siteName, rights, ntf_list, notification_num, ntf_posts, ntf_users)
        else:
            raise web.notfound()
示例#2
0
    def GET(self, username, page_num):
        u = users.get_user_by_username(username)
        page = int(page_num)
        perpage = 5
        offset = (page - 1) * perpage

        # url = web.ctx.get('path')
        # if int(url.count('recent')) == 0:
        created_posts = postModel.getCreatedPostsByUserId(u.id, offset, perpage).list()

        nodes = []
        for i in xrange(len(created_posts)):
            nodes += nodeModel.getNodesByNodeId(created_posts[i].nodeId)

        return view.post_list_member_profile_more(u, created_posts, nodes)
示例#3
0
    def GET(self, username, page_num):
        u = users.get_user_by_username(username)
        page = int(page_num)
        perpage = 5
        offset = (page - 1) * perpage

        # url = web.ctx.get('path')
        # if int(url.count('recent')) == 0:
        created_posts = postModel.getCreatedPostsByUserId(
            u.id, offset, perpage).list()

        nodes = []
        for i in xrange(len(created_posts)):
            nodes += nodeModel.getNodesByNodeId(created_posts[i].nodeId)

        return view.post_list_member_profile_more(u, created_posts, nodes)
示例#4
0
    def GET(self, username, p=1):
        u = users.get_user_by_username(username)
        if u:
            page = int(p)
            perpage = 5
            offset = (page - 1) * perpage

            created_posts = postModel.getCreatedPostsByUserId(u.id, offset, perpage).list()
            nodes = []
            for i in xrange(len(created_posts)):
                nodes += nodeModel.getNodesByNodeId(created_posts[i].nodeId)
            #得到资料
            profile = users.get_profile_by_user_id(u.id)
            #note 跳转到豆瓣
            # raise web.seeother('http://www.douban.com/people/'+ username)
            

            # pf = users.get_profile_by_user_id(u.id)
            # #得到上传的图片数
            # results,num_results = image.query(u.id)
            # #得到喜欢的图片数
            # fav_count = image.GetUserFavCount(u.id)

            # #得到用户上传的图片路径
            # imagePath = image.get_paths_by_id(u.id).list()
            # paths = []
            # for p in imagePath:
            #     paths += p.path.split()
            # #得到图片id
            # imageIDs = image.get_imageID_by_id(u.id).list()
            # img_ids = []
            # for i in imageIDs:
            #     img_ids += str(i.id).split()
            # return view.base(view.member_home(u, pf, paths, img_ids, num_results, fav_count), user, siteName)

            #是否登录,
            if user.is_logged:
                per = users.get_permission_by_douid(user.douban_id)
                rights = per[0].rights
                #得到提醒
                notification_results, notification_num = notification.get_unread_notification(user.id)
                #得到@提醒
                notification_mention_results, mention_num= notification.get_unread_metion_notifition(user.id)
                #链表 得到提醒的详细id\名称等
                ntf_posts = []
                ntf_users = []
                mtf_posts = []
                mtf_users = []

                ntf_list = notification_results.list()
                mtf_list = notification_mention_results.list()
                for x in xrange(len(ntf_list)):
                    ntf_posts += postModel.getPostsByPostId(ntf_list[x].pid)
                    ntf_users += users.get_users_by_id(ntf_list[x].uid)

                for x in xrange(len(mtf_list)):
                    mtf_posts += postModel.getPostsByPostId(mtf_list[x].pid)
                    mtf_users += users.get_users_by_id(mtf_list[x].uid)

                ntf_list = ntf_list + mtf_list
                ntf_posts = ntf_posts + mtf_posts
                ntf_users = ntf_users + mtf_users
                notification_num = notification_num+mention_num

            else:
                rights = 0
                is_voted = None
                notification_results = None
                notification_num = None
                ntf_list = None
                ntf_posts = None
                ntf_users = None
            return view.base(view.member_home(u, profile, created_posts, nodes, user, replace_breaks), user, siteName, rights, ntf_list, notification_num, ntf_posts, ntf_users)
        else:
            raise web.notfound()
示例#5
0
    def GET(self, username, p=1):
        u = users.get_user_by_username(username)
        print user

        if u:
            page = int(p)
            perpage = 5
            offset = (page - 1) * perpage

            created_posts = postModel.getCreatedPostsByUserId(
                u.id, offset, perpage).list()

            nodes = []
            for i in xrange(len(created_posts)):
                nodes += nodeModel.getNodesByNodeId(created_posts[i].nodeId)

            #得到资料
            profile = users.get_profile_by_user_id(u.id)

            #是否登录,
            if user.is_logged:
                per = users.get_permission_by_douid(user.douban_id)
                rights = per[0].rights
                #得到提醒
                notification_results, notification_num = notification.get_unread_notification(
                    user.id)
                #得到@提醒
                notification_mention_results, mention_num = notification.get_unread_metion_notifition(
                    user.id)
                #链表 得到提醒的详细id\名称等
                ntf_posts = []
                ntf_users = []
                mtf_posts = []
                mtf_users = []

                ntf_list = notification_results.list()
                mtf_list = notification_mention_results.list()
                for x in xrange(len(ntf_list)):
                    ntf_posts += postModel.getPostsByPostId(ntf_list[x].pid)
                    ntf_users += users.get_users_by_id(ntf_list[x].uid)

                for x in xrange(len(mtf_list)):
                    mtf_posts += postModel.getPostsByPostId(mtf_list[x].pid)
                    mtf_users += users.get_users_by_id(mtf_list[x].uid)

                ntf_list = ntf_list + mtf_list
                ntf_posts = ntf_posts + mtf_posts
                ntf_users = ntf_users + mtf_users
                notification_num = notification_num + mention_num

            else:
                rights = 0
                is_voted = None
                notification_results = None
                notification_num = None
                ntf_list = None
                ntf_posts = None
                ntf_users = None

            return view.base(
                view.member_home(u, profile, created_posts, nodes,
                                 user), user, siteName, rights, ntf_list,
                notification_num, ntf_posts, ntf_users)
        else:
            raise web.notfound()