fietsboek.models.journey module

Journey model definition.

A Journey is an ordered collection of tracks, with a title and (optionally) a description.

class fietsboek.models.journey.Journey(**kwargs)

Bases: Base

A Journey represents a collection of tracks, with a title and description.

description: Mapped[str]
classmethod factory(request)

Factory method to pass to a route definition.

This factory retrieves the journey based on the journey_id matched route parameter, and returns the journey. If the journey is not found, HTTPNotFound is raised.

Raises:

pyramid.httpexception.NotFound – If the journey is not found.

Parameters:

request (Request) – The pyramid request.

Return type:

Self

Returns:

The journey.

Type:

Track

gpx_xml()

Returns a GPX XML that represents this journey.

Return type:

bytes

Returns:

The XML file.

id: Mapped[int]
owner: Mapped[User]
owner_id: Mapped[int]
path()

Returns the concatenated path of all contained tracks.

Return type:

Path

set_track_ids(track_ids)

Sets the IDs of the contained tracks.

The order is relevant and will be saved.

Needs to have a session, as it will directly issue INSERT statements.

Parameters:

track_ids (list[int]) – The IDs of the tracks that should be in this journey.

title: Mapped[str]
tracks: Mapped[list[Track]]
visibility: Mapped[Visibility]
class fietsboek.models.journey.Visibility(*values)

Bases: Enum

An enum representing the visibility of Journeys.

FRIENDS = 2

Friends can see the journey.

LOGGED_IN = 3

Logged in users can see the journey.

PRIVATE = 1

Only the owner can see the journey.

PUBLIC = 4

Everybody can see the journey.