diff options
author | Daniel Schadt <kingdread@gmx.de> | 2023-04-01 00:00:27 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2023-04-01 00:00:27 +0200 |
commit | 73561d641ddc52eeca438d100472820721c6a04e (patch) | |
tree | 9a878c156b0163a4e7ba563fd4f135902cc53729 | |
parent | 114274f900904070e941c4a544426b5d9d1267d2 (diff) | |
download | fietsboek-73561d641ddc52eeca438d100472820721c6a04e.tar.gz fietsboek-73561d641ddc52eeca438d100472820721c6a04e.tar.bz2 fietsboek-73561d641ddc52eeca438d100472820721c6a04e.zip |
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.
-rw-r--r-- | fietsboek/models/user.py | 14 |
1 files 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 = [ |