Beispiel #1
0
 def get(self):
     action = self.param('action')
     values = {'action':action}
     if(action == 'edit'):
          key = self.param('id')
          pic = Picture.get_by_id(int(key))
          values.update({'pic':pic})
     self.generateBasePage('manage/pic.html', values)      
Beispiel #2
0
 def post(self):
     try:
         checkList = self.request.get_all('checks')
         for key in checkList:
             keyID = int(key)
             pic = Picture.get_by_id(keyID)
             pic.delete()
     finally:
         self.redirect('/picture')  
     return        
Beispiel #3
0
 def get(self):
     type = self.param('type')
     key = self.param('img_id')
     keyID = int(key)
     pic = Picture.get_by_id(keyID)
     if(pic):
         if(type == 'thumb'):
             content = pic.thumbnail
         else:
             content = pic.picContent
         self.response.headers['Content-Type'] = "image/png"
         self.response.out.write(content)
     else:
         self.response.out.write("No image")
         
     return
Beispiel #4
0
 def post(self):
     action = self.param('action')
     picName = self.request.get('picName')
     if(action == 'add'):
         picContent = self.request.get('pic')
         pic = Picture()
         pic.picName = picName
         if(picContent != None):
             pic.picContent = db.Blob(picContent)
             pic.thumbnail = db.Blob(images.resize(picContent,128,128))
         pic.put()
         pic.picLink = '/picture/show?img_id=%s&type=full'%pic.key().id()
         pic.put()
     elif(action == 'edit'):
          key = self.param('id')
          pic = Picture.get_by_id(int(key))
          pic.picName = picName
          pic.put()
     self.redirect('/picture')