Ejemplo n.º 1
0
def solution_put_photo_info_ddb(user_id, filename, form, filesize):

    try:
        new_photo = Photo(id=filename,
                          user_id=user_id,
                          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'])

        new_photo.save()

    except Exception as e:
        app.logger.error(
            "ERROR:failed to put item into Photo table:user_id:{}, filename:{}"
            .format(user_id, filename))
        app.logger.error(e)
        raise e
Ejemplo n.º 2
0
def solution_put_photo_info_ddb(user_id, filename, form, filesize):
    app.logger.info('RUNNING TODO#3 SOLUTION CODE:')
    app.logger.info('Update Photo information into User table!')
    app.logger.info(
        'Follow the steps in the lab guide to replace this method with your own implementation.'
    )

    new_photo = Photo(id=filename,
                      user_id=user_id,
                      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'])

    new_photo.save()
Ejemplo n.º 3
0
def solution_put_photo_info_ddb(user_id, filename, form, filesize):
    new_photo = Photo(id=filename,
                      user_id=user_id,
                      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'])
    new_photo.save()
Ejemplo n.º 4
0
def solution_put_photo_info_ddb(user_id, filename, form, filesize):
    app.logger.info("RUNNING TODO#3 SOLUTION CODE:")
    app.logger.info("Update Photo information into User table!")
    app.logger.info(
        "Follow the steps in the lab guide to replace this method with your own implementation."
    )

    try:
        new_photo = Photo(id=filename,
                          user_id=user_id,
                          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'])

        new_photo.save()

    except Exception as e:
        app.logger.error(
            "ERROR:failed to put item into Photo table:user_id:{}, filename:{}"
            .format(user_id, filename))
        app.logger.error(e)
        raise e