def PhotoView(response): try: try: usrid = sessions.get_uid(response) photoid = int(response.get_field('photo')) except: usrid = sessions.get_uid(response) photoid = 1 conn = database_engine.Get_DatabaseConnection() curs = conn.cursor() curs.execute("""SELECT userid FROM photos WHERE photoid=?""", (response.get_field('photo'), )) if curs.fetchone()[0] == usrid: button = photoHTMLrenderer.RenderEditButton(photoid) else: button = "" comments = photoAPI._photo_GetPicComments(photoid) result = photoHTMLrenderer.PhotoPageRender(photoid, usrid) page = TemplateAPI.render( 'photoview.tem', response, { 'edit': button, 'comments': comments, 'photo': photoid, 'usr': usrid, 'imgtag': result[0], 'title': result[1], 'description': result[2] }) response.write(page) except: response.redirect("/internal_error")
def PhotoView(response): try: try: usrid = sessions.get_uid(response) photoid = int(response.get_field("photo")) except: usrid = sessions.get_uid(response) photoid = 1 conn = database_engine.Get_DatabaseConnection() curs = conn.cursor() curs.execute("""SELECT userid FROM photos WHERE photoid=?""", (response.get_field("photo"),)) if curs.fetchone()[0] == usrid: button = photoHTMLrenderer.RenderEditButton(photoid) else: button = "" comments = photoAPI._photo_GetPicComments(photoid) result = photoHTMLrenderer.PhotoPageRender(photoid, usrid) page = TemplateAPI.render( "photoview.tem", response, { "edit": button, "comments": comments, "photo": photoid, "usr": usrid, "imgtag": result[0], "title": result[1], "description": result[2], }, ) response.write(page) except: response.redirect("/internal_error")
def photo_multiuploaderhander(response): try: userid = sessions.get_uid(response) eventid = int(response.get_field("event")) datalist = response.get_files("uploads") response.write(photoUploader.HandleEventMultiupload(datalist, userid, eventid)) except ZeroDivisionError: response.redirect("/internal_error")
def photo_multiuploaderhander(response): try: userid = sessions.get_uid(response) eventid = int(response.get_field('event')) datalist = response.get_files('uploads') response.write( photoUploader.HandleEventMultiupload(datalist, userid, eventid)) except ZeroDivisionError: response.redirect("/internal_error")
def CommentCommit(response): try: usrid = sessions.get_uid(response) photoid = int(response.get_field('photo')) except: response.redirect("/internal_error") comment = response.get_field('comment') photoAPI.Photo_WriteComment(photoid, comment, usrid) response.redirect("/picview?photo=" + str(photoid))
def CommentCommit(response): try: usrid = sessions.get_uid(response) photoid = int(response.get_field("photo")) except: response.redirect("/internal_error") comment = response.get_field("comment") photoAPI.Photo_WriteComment(photoid, comment, usrid) response.redirect("/picview?photo=" + str(photoid))
def ProcessPhotoMetadata(response): userid = sessions.get_uid(response) photoid = int(response.get_field("photo")) conn = database_engine.Get_DatabaseConnection() description = response.get_field("desc") tags = response.get_field("tags").split(" ") curs = conn.cursor() curs.execute("""DELETE FROM phototags WHERE photoid=?""", (photoid,)) conn.commit() response.write("""<script type="text/javascript">self.close();</script>""") curs = conn.cursor() curs.execute("""UPDATE photos SET description=? WHERE photoid=?""", (description, int(photoid))) conn.commit() curs = conn.cursor() for tag in tags: curs.execute("""INSERT INTO phototags(tag, photoid) values (?, ?)""", (tag, photoid)) conn.commit()
def ProcessPhotoMetadata(response): userid = sessions.get_uid(response) photoid = int(response.get_field('photo')) conn = database_engine.Get_DatabaseConnection() description = response.get_field('desc') tags = response.get_field('tags').split(" ") curs = conn.cursor() curs.execute("""DELETE FROM phototags WHERE photoid=?""", (photoid, )) conn.commit() response.write("""<script type="text/javascript">self.close();</script>""") curs = conn.cursor() curs.execute("""UPDATE photos SET description=? WHERE photoid=?""", ( description, int(photoid), )) conn.commit() curs = conn.cursor() for tag in tags: curs.execute("""INSERT INTO phototags(tag, photoid) values (?, ?)""", (tag, photoid)) conn.commit()