コード例 #1
0
ファイル: admin.py プロジェクト: atistler/mike-art
 def migrate(self, id):
     img = ImageModel.get(id)
     if (img):
         result = ImageModel2.gql("WHERE orig_image = :img", img=img.key()).fetch(1)
         if not result:
             imgblob             = ImageBlobModel()
             imgblob.image       = img.image
             imgblob.thumbnail   = img.thumbnail
             imgblob.put()
         
             img2            = ImageModel2()
             img2.name       = img.name
             img2.desc       = img.desc
             img2.priority   = img.priority
             img2.orig_image = img.key()
             img2.gallery    = img.gallery
             img2.imageblob  = imgblob.key()
             img2.put()
             referrer = self.request.headers['referer']
             self.redirect(referrer)
         else:
             logging.info("Image %s has already been migrated" % img.key())
             referrer = self.request.headers['referer']
             self.redirect(referrer)                
     else:
         self.error(503)
コード例 #2
0
ファイル: admin.py プロジェクト: atistler/mike-art
 def migrate_all(self, id):
     gal = GalleryModel.get(id)
     if (gal):
         imgs = ImageModel.gql("WHERE gallery = :gallery", gallery=gal.key()).fetch(_MAX_FETCH)
         for img in imgs:
             result = ImageModel2.gql("WHERE orig_image = :img", img=img.key()).fetch(1)
             if not result:
                 imgblob             = ImageBlobModel()
                 imgblob.image       = img.image
                 imgblob.thumbnail   = img.thumbnail
                 imgblob.put()
         
                 img2            = ImageModel2()
                 img2.name       = img.name
                 img2.desc       = img.desc
                 img2.orig_image = img.key()
                 img2.priority   = img.priority
                 img2.gallery    = img.gallery
                 img2.imageblob  = imgblob.key()
                 img2.put()   
             else:
                 logging.info("Image %s has already been migrated" % img.key())
                 
     else:
         logging.info("Gallery %s not found" % id)
         self.error(503)
コード例 #3
0
ファイル: admin.py プロジェクト: atistler/mike-art
 def migrate_all(self):
     imgs = ImageModel.all()
     for img in imgs:
         result = ImageModel2.gql("WHERE orig_image = :img", img=img.key()).fetch(1)
         if not result:
             imgblob             = ImageBlobModel()
             imgblob.image       = img.image
             imgblob.thumbnail   = img.thumbnail
             imgblob.put()
         
             img2            = ImageModel2()
             img2.name       = img.name
             img2.desc       = img.desc
             img2.orig_image = img.key()
             img2.priority   = img.priority
             img2.gallery    = img.gallery
             img2.imageblob  = imgblob.key()
             img2.put()
         else:
             logging.info("Image %s has already been migrated" % img.key())