def hashfix(request): log = DBSession.query(Log).filter(Log.id==52).one() images = DBSession.query(Image).filter(Image.logs.contains(log)).order_by(Image.timestamp_original).all() n = 0 for image in images: hash = hashlib.sha256(open(image.location+image.name).read()).hexdigest() if image.hash != hash: print '#', n n=n+1 print image.id, image.location+image.name, image.hash print image.id, image.location+image.name, hash, '\n' image.hash = hash return Response('OK')
def authors_view(request): owner = authenticated_userid(request) author = Author.get_author(owner) authors = DBSession.query(Author).all() return { 'authors': sorted([a.name for a in authors]), 'author': author }
def login_view(request): next = request.params.get('next') or request.route_url('overview') name = '' did_fail = False authors = DBSession.query(Author).all() if 'submit' in request.POST: name = request.POST.get('name', '') password = request.POST.get('password', '') author = Author.get_author(name) if author and author.validate_password(password): headers = remember(request, name) return HTTPFound(location=next, headers=headers) did_fail = True return { 'name': name, 'next': next, 'failed_attempt': did_fail, 'authors': authors, 'request': request }