Example #1
0
  def post(self):
    id = long(self.request.get('id'))
    artwork_json = json.loads(self.request.get('json'))
    crop_tuple = tuple(float(x) for x in json.loads(self.request.get('crop')))
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      self.response.set_status(404)
      return

    target_artwork.title = artwork_json['title']
    target_artwork.byline = artwork_json['byline']

    new_image_url, new_thumb_url = maybe_process_image(
        artwork_json['imageUri'],
        crop_tuple,
        target_artwork.publish_date.strftime('%Y%m%d') + ' '
            + artwork_json['title'] + ' '
            + artwork_json['byline'])
    if not new_thumb_url and 'thumbUri' in artwork_json:
      new_thumb_url = artwork_json['thumbUri']

    target_artwork.image_url = new_image_url
    target_artwork.thumb_url = new_thumb_url
    target_artwork.details_url = artwork_json['detailsUri']
    target_artwork.save()
    self.response.set_status(200)
Example #2
0
    def post(self):
        id = long(self.request.get('id'))
        artwork_json = json.loads(self.request.get('json'))
        crop_tuple = tuple(
            float(x) for x in json.loads(self.request.get('crop')))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            self.response.set_status(404)
            return

        target_artwork.title = artwork_json['title']
        target_artwork.byline = artwork_json['byline']

        new_image_url, new_thumb_url = maybe_process_image(
            artwork_json['imageUri'], crop_tuple,
            target_artwork.publish_date.strftime('%Y%m%d') + ' ' +
            artwork_json['title'] + ' ' + artwork_json['byline'])
        if not new_thumb_url and 'thumbUri' in artwork_json:
            new_thumb_url = artwork_json['thumbUri']

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json['detailsUri']
        target_artwork.save()
        self.response.set_status(200)
Example #3
0
    def post(self):
        id = long(self.request.get("id"))
        artwork_json = json.loads(self.request.get("json"))
        crop_tuple = tuple(float(x) for x in json.loads(self.request.get("crop")))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            self.response.set_status(404)
            return

        target_artwork.title = artwork_json["title"]
        target_artwork.byline = artwork_json["byline"]

        new_image_url, new_thumb_url = maybe_process_image(
            artwork_json["imageUri"],
            crop_tuple,
            target_artwork.publish_date.strftime("%Y%m%d") + " " + artwork_json["title"] + " " + artwork_json["byline"],
        )
        if not new_thumb_url and "thumbUri" in artwork_json:
            new_thumb_url = artwork_json["thumbUri"]

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json["detailsUri"]
        target_artwork.save()
        self.response.set_status(200)
Example #4
0
    def post(self):
        id = long(self.request.get('id'))
        artwork_json = json.loads(self.request.get('json'))
        crop_tuple = tuple(
            float(x) for x in json.loads(self.request.get('crop')))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        target_artwork.title = artwork_json['title']
        target_artwork.byline = artwork_json['byline']
        target_artwork.attribution = artwork_json[
            'attribution'] if 'attribution' in artwork_json else None

        new_image_url, new_thumb_url = backroomarthelper.maybe_process_image(
            artwork_json['imageUri'], crop_tuple,
            target_artwork.publish_date.strftime('%Y%m%d') + ' ' +
            artwork_json['title'] + ' ' + artwork_json['byline'])
        if not new_thumb_url and 'thumbUri' in artwork_json:
            new_thumb_url = artwork_json['thumbUri']

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json['detailsUri']
        target_artwork.save()

        self.response.set_status(200)
        self.response.out.write(json.dumps(artwork_dict(target_artwork)))
Example #5
0
    def post(self):
        id = long(self.request.get("id"))
        artwork_json = json.loads(self.request.get("json"))
        crop_tuple = tuple(float(x) for x in json.loads(self.request.get("crop")))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        target_artwork.title = artwork_json["title"]
        target_artwork.byline = artwork_json["byline"]
        target_artwork.attribution = artwork_json["attribution"] if "attribution" in artwork_json else None

        new_image_url, new_thumb_url = backroomarthelper.maybe_process_image(
            artwork_json["imageUri"],
            crop_tuple,
            target_artwork.publish_date.strftime("%Y%m%d") + " " + artwork_json["title"] + " " + artwork_json["byline"],
        )
        if not new_thumb_url and "thumbUri" in artwork_json:
            new_thumb_url = artwork_json["thumbUri"]

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json["detailsUri"]
        target_artwork.save()

        self.response.set_status(200)
        self.response.out.write(json.dumps(artwork_dict(target_artwork)))
Example #6
0
  def post(self):
    id = long(self.request.get('id'))
    artwork_json = json.loads(self.request.get('json'))
    crop_tuple = tuple(float(x) for x in json.loads(self.request.get('crop')))
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      webapp2.abort(404)

    target_artwork.title = artwork_json['title']
    target_artwork.byline = artwork_json['byline']
    target_artwork.attribution = artwork_json['attribution'] if 'attribution' in artwork_json else None

    new_image_url, new_thumb_url = maybe_process_image(
        artwork_json['imageUri'],
        crop_tuple,
        target_artwork.publish_date.strftime('%Y%m%d') + ' '
            + artwork_json['title'] + ' '
            + artwork_json['byline'])
    if not new_thumb_url and 'thumbUri' in artwork_json:
      new_thumb_url = artwork_json['thumbUri']

    target_artwork.image_url = new_image_url
    target_artwork.thumb_url = new_thumb_url
    target_artwork.details_url = artwork_json['detailsUri']
    target_artwork.save()

    self.response.set_status(200)
    self.response.out.write(json.dumps(artwork_dict(target_artwork)))
Example #7
0
 def post(self):
   id = long(self.request.get('id'))
   target_artwork = FeaturedArtwork.get_by_id(id)
   if not target_artwork:
     self.response.set_status(404)
     return
   target_artwork.delete()
   self.response.set_status(200)
Example #8
0
 def post(self):
     id = long(self.request.get('id'))
     target_artwork = FeaturedArtwork.get_by_id(id)
     if not target_artwork:
         self.response.set_status(404)
         return
     target_artwork.delete()
     self.response.set_status(200)
Example #9
0
    def post(self):
        id = long(self.request.get("id"))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        target_artwork.delete()
        self.response.set_status(200)
Example #10
0
    def post(self):
        id = long(self.request.get("id"))
        publish_date = datetime.datetime.utcfromtimestamp(long(self.request.get("publishDate")) / 1000).date()
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        # shift other artworks over
        self.move_artwork(target_artwork, publish_date, target_artwork.key().id())
        self.response.set_status(200)
Example #11
0
    def post(self):
        id = long(self.request.get('id'))
        publish_date = (datetime.datetime.utcfromtimestamp(
            long(self.request.get('publishDate')) / 1000).date())
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            webapp2.abort(404)

        # shift other artworks over
        self.move_artwork(target_artwork, publish_date,
                          target_artwork.key().id())
        self.response.set_status(200)
Example #12
0
  def post(self):
    id = long(self.request.get('id'))
    publish_date = (datetime.datetime
        .utcfromtimestamp(long(self.request.get('publishDate')) / 1000)
        .date())
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      self.response.set_status(404)
      return

    # shift other artworks over
    self.move_artwork(target_artwork, publish_date, target_artwork.key().id())
    self.response.set_status(200)
Example #13
0
  def post(self):
    id = long(self.request.get('id'))
    artwork_json = json.loads(self.request.get('json'))
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      self.response.set_status(404)
      return

    target_artwork.title = artwork_json['title']
    target_artwork.byline = artwork_json['byline']
    target_artwork.image_url = artwork_json['imageUri']
    target_artwork.thumb_url = (artwork_json['thumbUri']
               if 'thumbUri' in artwork_json
               else (artwork_json['imageUri'] + '!BlogSmall.jpg'))
    target_artwork.details_url = artwork_json['detailsUri']
    target_artwork.save()
    self.response.set_status(200)
    def post(self):
        id = long(self.request.get('id'))
        artwork_json = json.loads(self.request.get('json'))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            self.response.set_status(404)
            return

        target_artwork.title = artwork_json['title']
        target_artwork.byline = artwork_json['byline']
        target_artwork.image_url = artwork_json['imageUri']
        target_artwork.thumb_url = (artwork_json['thumbUri']
                                    if 'thumbUri' in artwork_json else
                                    (artwork_json['imageUri'] +
                                     '!BlogSmall.jpg'))
        target_artwork.details_url = artwork_json['detailsUri']
        target_artwork.save()
        self.response.set_status(200)
Example #15
0
  def post(self):
    id = long(self.request.get('id'))
    artwork_json = json.loads(self.request.get('json'))
    target_artwork = FeaturedArtwork.get_by_id(id)
    if not target_artwork:
      self.response.set_status(404)
      return

    target_artwork.title = artwork_json['title']
    target_artwork.byline = artwork_json['byline']

    new_image_url, new_thumb_url = maybe_process_image(
        artwork_json['imageUri'],
        artwork_json['title'] + ' ' + artwork_json['byline'])
    if not new_thumb_url and 'thumbUri' in artwork_json:
      new_thumb_url = artwork_json['thumbUri']

    target_artwork.image_url = new_image_url
    target_artwork.thumb_url = new_thumb_url
    target_artwork.details_url = artwork_json['detailsUri']
    target_artwork.save()
    self.response.set_status(200)
Example #16
0
    def post(self):
        id = long(self.request.get('id'))
        artwork_json = json.loads(self.request.get('json'))
        target_artwork = FeaturedArtwork.get_by_id(id)
        if not target_artwork:
            self.response.set_status(404)
            return

        target_artwork.title = artwork_json['title']
        target_artwork.byline = artwork_json['byline']

        new_image_url, new_thumb_url = maybe_process_image(
            artwork_json['imageUri'],
            artwork_json['title'] + ' ' + artwork_json['byline'])
        if not new_thumb_url and 'thumbUri' in artwork_json:
            new_thumb_url = artwork_json['thumbUri']

        target_artwork.image_url = new_image_url
        target_artwork.thumb_url = new_thumb_url
        target_artwork.details_url = artwork_json['detailsUri']
        target_artwork.save()
        self.response.set_status(200)