Exemple #1
0
    def _post_update_images(self, par):

        key = self._pl["key"]
        which = self._pl["which"]
        url = self._pl["url"]
        parcontent = Content.get_by_key_name(key)
        content = parcontent.editing

        if which == "mainimage":
            image = Image.get_by_id(int(url))

            content.mainimage = image
            content.imagepath = None  # so reset the path

            if content.thumb == None:
                content.thumb = images.get_serving_url(image.blob_key, 150)

        elif which == "thumb":
            content.thumb = url

        elif which == "reset_thumb":
            image = content.mainimage
            if image:
                content.thumb = images.get_serving_url(image.blob_key, 150)

        elif which == "main_url":
            content.imagepath = url  # so reset the path

        elif which == "thumb_url":
            content.thumb = url  # so reset the path

        content.put()

        # respond with a good code
        self._req.draw_code()
Exemple #2
0
    def _post_update_images(self, par):
        
        key = self._pl['key']
        which = self._pl['which']
        url = self._pl['url']
        parcontent = Content.get_by_key_name(key)
        content = parcontent.editing
        
        if which == "mainimage":
            image = Image.get_by_id(int(url))
            
            content.mainimage = image
            content.imagepath = None   # so reset the path    

            if content.thumb == None:
                content.thumb = images.get_serving_url(image.blob_key, 150)

        elif which == "thumb":
            content.thumb = url

        elif which == "reset_thumb":
            image = content.mainimage
            if image:
                content.thumb = images.get_serving_url(image.blob_key, 150) 
            
        content.put()
Exemple #3
0
 def get_image(self, par):
     """ called directly from main get router """
     try:
         iid = int(par[0]);
         img = Image.get_by_id(iid)
         if img:
             self._req.redirect(str(img.serving_url))
         else:
             self._req.notfound()
     except:
         self._req.notfound()