Esempio n. 1
0
 def get(self,key):
     user_key = self.get_secure_cookie("user_key")
         
     board  = Board()
     query = {}
     query['q'] = "user:%s" % user_key            
     _data = board.solr(query)  
     
     thumb = Thumb()        
     pic = Pic() 
     
     pic_url = pic.get(key)['url']
     thumb_url = thumb.get(key)['url']
     
     self.render('repin.html',boards = _data,pic_url=pic_url,thumb_url=thumb_url)
Esempio n. 2
0
 def post(self):
     import time        
     board_key    = self.get_argument("board",None)
     pic_url      = self.get_argument("pic_url",None)
     thumb_url    = self.get_argument("thumb_url",None)
     content      = self.get_argument("content",None)        
     
     pin       = Pin()
     thumb     = Thumb()
     pic       = Pic()
     board     = Board()
     
     board.data  =board.get(board_key)
     
     user_key = self.get_secure_cookie('user_key')
     
     _tmp = "%s%s" % (content,user_key)
     pin_key = pin.genKey(_tmp)
     
     if pin_key not in board.data['pins']:
         board.data['pins'].append(pin_key)
     board.key      = board.data['key']
     
     pin.key = pin_key
     
     pin.data['rawtext'] = content
     pin.data['user']    = user_key
     pin.data['board']   = board_key
     pin.data['category']   = board.data['category']
     pin.data['createTime'] = int(time.time())
     
     pic.key = pin_key
     pic.data['url'] = pic_url
     
     thumb.key = pin_key
     thumb.data['url'] = thumb_url
     
     try:
         board.put()
         pin.post()
         pic.post()
         thumb.post()
                   
     except Exception as what:
         print what
         self.write(what)
     else:
         self.redirect('/mark/%s/' % pin_key)   
Esempio n. 3
0
 def getPinDetail(self,key):        
     board = Board()
     user = User()
     thumb = Thumb()        
     pic = Pic()        
     comment = Comment()    
     
     marks_dict = []
     pin = self.get(key)
     _pin = {}
     _pin['pin']               = self.get(key)
     _pin['user']              = user.getDetail(pin['user'])
     _pin['pin']['pic']        = pic.get(pin['key'])['url']
     
     
     _pin['board']             = board.getDetailWithPinThumb(pin['board']) 
     
     _pin['comments']         = comment.getByPin( pin['key'])           
         
     return _pin