當前位置: 首頁>>代碼示例>>Python>>正文


Python Board.allKey方法代碼示例

本文整理匯總了Python中models.board.Board.allKey方法的典型用法代碼示例。如果您正苦於以下問題:Python Board.allKey方法的具體用法?Python Board.allKey怎麽用?Python Board.allKey使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在models.board.Board的用法示例。


在下文中一共展示了Board.allKey方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get

# 需要導入模塊: from models.board import Board [as 別名]
# 或者: from models.board.Board import allKey [as 別名]
 def get(self):        
     board = Board()
     keys = board.allKey()        
     _data = board.all(keys)
     print _data
     #self.dumpJson(keys)       
     self.render('manager/board.html',data=_data)
開發者ID:aviatorBeijing,項目名稱:ptpy,代碼行數:9,代碼來源:board.py

示例2: get

# 需要導入模塊: from models.board import Board [as 別名]
# 或者: from models.board.Board import allKey [as 別名]
    def get(self,key):
        uri = self.request.uri
        request = {}
        board = Board()
        
        pin_keys = board.allKey()
        pin_count = len(pin_keys)
        
        query = {}
        query['q']         = "user:%s" % key
                
        query['start']  = "0"
        query['rows']   = globalSetting['max_index_board_rows']
        query['sort']   = "follow"
        
        if "page" in uri:
            request = urldecode(uri)
            page = int(request['page'])
            query['start']  = query['rows']*page
            #if pin_count < query['rows']*page:
            #    return ''
        
        board_data = board.solr(query)
        print len(board_data)
                
        boards_dict = board.formatBoards(board_data)

        if request:
            #print request['callback']
            #print request['page']            
            callback_result = {
                            'filter':'board:index',
                            'boards':boards_dict
                            }
            
            callback_response = "%s(%s)" % (request['callback'],json.dumps(callback_result))
            self.set_header("Content-Type", "text/html; charset=utf-8")            
            return self.write(callback_response)
        else:            
            user = User()
            boards = ''
            for _board_t in boards_dict:
                boards = self.render_string('board_unit.html',board=_board_t) + boards
                
            u_user = user.getInfo(key)
            
            userFollow = UserFollow()
            counts = {}
            counts['follow'] = len(userFollow.getByKeyValues("user", key))
            
            counts['fans'] = len(userFollow.getByKeyValues("follow", key)) 
 
            self.render('user_board.html',counts=counts,u_user=u_user,user=self.currentUserInfo(),boards=boards)    
開發者ID:aviatorBeijing,項目名稱:ptpy,代碼行數:55,代碼來源:user.py


注:本文中的models.board.Board.allKey方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。