Exemple #1
0
 def get(self, id):
     id = urllib.unquote(urllib.unquote(id))
     greetings = FotosDB2.get_by_id(int(id))
     if greetings.user == users.get_current_user().nickname():
         blob = blobstore.BlobInfo.get(greetings.foto)
         blob.delete()
         greetings.delete()
     else:
         pass
     return self.redirect('/fotos/%s' % users.get_current_user().nickname())
Exemple #2
0
 def get(self, mode, ruser):
     self.valid_chars = frozenset("0123456789")
     self.response.headers['Content-Type'] = "image/png"
     no_valid = False
     if ruser is int:
         ruser = ruser
     for n in ruser:
         if n in self.valid_chars:
             pass
         else:
             no_valid = True
     if no_valid:
         fname = 'img_m.txt'
         img_f = open(fname, 'r')
         image = img_f.read()
         return self.response.out.write(image)
     else:
         ruser = urllib.unquote(urllib.unquote(ruser))
         mode = urllib.unquote(urllib.unquote(mode))
         foto_get = FotosDB.get_by_id(int(ruser))
         if mode == 'big':
             foto = foto_get.foto_big
         elif mode == 'pc':
             foto = foto_get.foto_pc
         if mode == 'big':
             foto = foto_get.foto_big
         elif mode == 'mob':
             foto = foto_get.foto_mob
         if mode == 'big':
             foto = foto_get.foto_big
         elif mode == 'org':
             foto = blobstore.BlobInfo.get(foto_get.foto)
             return self.send_blob(foto)
         if foto:
             return self.response.out.write(foto)
         else:
             fname = 'img_m.txt'
             img_f = open(fname, 'r')
             image = img_f.read()
             return self.response.out.write(image)