Exemple #1
0
    def get(self):
        """Get all photos as list"""
        try:
            photos = [
                photo_deserialize(photo)
                for photo in Photo.query(get_jwt_identity()['user_id'])
            ]
            app.logger.debug('success:photos_list: {}'.format(photos))
            return make_response({'ok': True, 'photos': photos}, 200)

        except Exception as e:
            app.logger.error('Photos list retrieving failed')
            app.logger.error(e)
            raise InternalServerError('Photos list retrieving failed')
Exemple #2
0
    def get(self):
        """Get all photos as list"""

        data = {'photos': []}
        try:
            photos = Photo.query(get_jwt_identity()['user_id'])
            for photo in photos:
                data['photos'].append(photo_deserialize(photo))

            app.logger.debug("success:photos_list:{}".format(data))
            return m_response(data['photos'], 200)
        except Exception as e:
            app.logger.error("ERROR:photos list failed")
            app.logger.error(e)
            return err_response(e, 500)
Exemple #3
0
def create_photo_info(filename, filesize, form):
    new_photo = Photo(id=filename,
                      filename=filename,
                      filename_orig=form['file'].filename,
                      filesize=filesize,
                      upload_date=datetime.today(),
                      tags=form['tags'],
                      desc=form['desc'],
                      geotag_lat=form['geotag_lat'],
                      geotag_lng=form['geotag_lng'],
                      taken_date=datetime.strptime(form['taken_date'], "%Y:%m:%d %H:%M:%S"),
                      make=form['make'],
                      model=form['model'],
                      width=form['width'],
                      height=form['height'],
                      city=form['city'],
                      nation=form['nation'],
                      address=form['address'])

    app.logger.debug('new_photo: {0}'.format(photo_deserialize(new_photo)))
    return new_photo