diff options
-rw-r--r-- | fietsboek/models/track.py | 1 | ||||
-rw-r--r-- | fietsboek/models/user.py | 1 | ||||
-rw-r--r-- | fietsboek/routes.py | 2 | ||||
-rw-r--r-- | fietsboek/scripts/fietsctl.py | 1 | ||||
-rw-r--r-- | fietsboek/summaries.py | 3 | ||||
-rw-r--r-- | fietsboek/util.py | 2 | ||||
-rw-r--r-- | fietsboek/views/default.py | 7 | ||||
-rw-r--r-- | fietsboek/views/detail.py | 1 | ||||
-rw-r--r-- | fietsboek/views/profile.py | 1 | ||||
-rw-r--r-- | fietsboek/views/upload.py | 3 |
10 files changed, 13 insertions, 9 deletions
diff --git a/fietsboek/models/track.py b/fietsboek/models/track.py index 58e9745..d2e736a 100644 --- a/fietsboek/models/track.py +++ b/fietsboek/models/track.py @@ -121,6 +121,7 @@ track_badge_assoc = Table( # as some of them store timestamps as UTC time. The problem of finding some # local timestamp is delegated to util.guess_gpx_timestamp(). + class Track(Base): """A :class:`Track` represents a single GPX track. diff --git a/fietsboek/models/user.py b/fietsboek/models/user.py index 84aa4d9..fa6bd7f 100644 --- a/fietsboek/models/user.py +++ b/fietsboek/models/user.py @@ -107,7 +107,6 @@ class User(Base): friends_2 = relationship('User', secondary='friends_assoc', back_populates='friends_1', foreign_keys=[friends_assoc.c.user_2_id]) - @classmethod def query_by_email(cls, email): """Returns a query that can be used to query a user by its email. diff --git a/fietsboek/routes.py b/fietsboek/routes.py index dad8026..2ea529c 100644 --- a/fietsboek/routes.py +++ b/fietsboek/routes.py @@ -1,4 +1,6 @@ """Route definitions for the main Fietsboek application.""" + + def includeme(config): # pylint: disable=missing-function-docstring config.add_static_view('static', 'static', cache_max_age=3600) diff --git a/fietsboek/scripts/fietsctl.py b/fietsboek/scripts/fietsctl.py index 1c6a8c0..e8f7b3f 100644 --- a/fietsboek/scripts/fietsctl.py +++ b/fietsboek/scripts/fietsctl.py @@ -136,7 +136,6 @@ def cmd_passwd(env, args): return EXIT_OKAY - def parse_args(argv): """Parse the given args. diff --git a/fietsboek/summaries.py b/fietsboek/summaries.py index efaab42..9d4c0aa 100644 --- a/fietsboek/summaries.py +++ b/fietsboek/summaries.py @@ -1,4 +1,6 @@ """Module for a yearly/monthly track summary.""" + + class Summary: """A summary of a user's tracks. @@ -42,6 +44,7 @@ class Summary: """ return sum(track.length for track in self.all_tracks()) + class YearSummary: """A summary over a single year. diff --git a/fietsboek/util.py b/fietsboek/util.py index f62a0d5..32b56e3 100644 --- a/fietsboek/util.py +++ b/fietsboek/util.py @@ -99,7 +99,7 @@ def guess_gpx_timezone(gpx): # that some devices save their times in UTC, so we need to look for a # timestamp different than UTC. for time in times: - if time.tzinfo and time.tzinfo.utcoffset(time): + if time.tzinfo and time.tzinfo.utcoffset(time): return time.tzinfo # Next, we look if there's a "localTime" extension on the track, so we can diff --git a/fietsboek/views/default.py b/fietsboek/views/default.py index 042e48c..e7a1cb0 100644 --- a/fietsboek/views/default.py +++ b/fietsboek/views/default.py @@ -134,10 +134,9 @@ def do_password_reset(request): request.localizer.translate(_("page.password_reset.email.subject")), ) mail.set_content( - request - .localizer - .translate(_("page.password_reset.email.body")) - .format(request.route_url('use-token', uuid=token.uuid)) + request.localizer + .translate(_("page.password_reset.email.body")) + .format(request.route_url('use-token', uuid=token.uuid)) ) email.send_message(request.registry.settings, mail) diff --git a/fietsboek/views/detail.py b/fietsboek/views/detail.py index 4990953..a15b29d 100644 --- a/fietsboek/views/detail.py +++ b/fietsboek/views/detail.py @@ -30,6 +30,7 @@ def details(request): 'description': description, } + @view_config(route_name='gpx', http_cache=3600, permission='track.view') def gpx(request): """Returns the actual GPX data from the stored track. diff --git a/fietsboek/views/profile.py b/fietsboek/views/profile.py index ad481db..f4acd3d 100644 --- a/fietsboek/views/profile.py +++ b/fietsboek/views/profile.py @@ -58,7 +58,6 @@ def do_change_profile(request): return HTTPFound(request.route_url('profile')) - @view_config(route_name='add-friend', permission='user', request_method='POST') def do_add_friend(request): """Sends a friend request. diff --git a/fietsboek/views/upload.py b/fietsboek/views/upload.py index 7a1059b..979291e 100644 --- a/fietsboek/views/upload.py +++ b/fietsboek/views/upload.py @@ -151,7 +151,7 @@ def do_finish_upload(request): track = models.Track( owner=request.identity, title=request.params["title"], - visibility = Visibility[request.params["visibility"]], + visibility=Visibility[request.params["visibility"]], description=request.params["description"], badges=badges, link_secret=util.random_alphanum_string(), @@ -173,6 +173,7 @@ def do_finish_upload(request): return HTTPFound(request.route_url('details', track_id=track.id)) + @view_config(route_name='cancel-upload', permission='upload.finish', request_method="POST") def cancel_upload(request): """Cancels the upload and clears the temporary data. |