From 73561d641ddc52eeca438d100472820721c6a04e Mon Sep 17 00:00:00 2001 From: Daniel Schadt Date: Sat, 1 Apr 2023 00:00:27 +0200 Subject: fix copy/paste error We copied the factory method from Track, but forgot to change some of the words. Now the code fits better with what the function is doing. As a bonus, pylint no longer complains about a duplicate method. --- fietsboek/models/user.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fietsboek/models/user.py b/fietsboek/models/user.py index 58a04bd..e1b4841 100644 --- a/fietsboek/models/user.py +++ b/fietsboek/models/user.py @@ -141,20 +141,20 @@ class User(Base): def factory(cls, request: Request) -> "User": """Factory method to pass to a route definition. - This factory retrieves the track based on the ``track_id`` matched - route parameter, and returns the track. If the track is not found, + This factory retrieves the user based on the ``user_id`` matched + route parameter, and returns the user. If the user is not found, ``HTTPNotFound`` is raised. - :raises pyramid.httpexception.NotFound: If the track is not found. + :raises pyramid.httpexception.NotFound: If the user is not found. :param request: The pyramid request. - :return: The track. + :return: The user. """ user_id = request.matchdict["user_id"] query = select(cls).filter_by(id=user_id) - track = request.dbsession.execute(query).scalar_one_or_none() - if track is None: + user = request.dbsession.execute(query).scalar_one_or_none() + if user is None: raise HTTPNotFound() - return track + return user def __acl__(self): acl = [ -- cgit v1.2.3