diff options
-rw-r--r-- | fietsboek/views/edit.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/fietsboek/views/edit.py b/fietsboek/views/edit.py index a26452d..b3dcf1e 100644 --- a/fietsboek/views/edit.py +++ b/fietsboek/views/edit.py @@ -81,20 +81,22 @@ def do_edit(request): if any(user not in track.tagged_people and user not in user_friends for user in tagged_people): return HTTPBadRequest() + data = request.data_manager.open(track.id) tz_offset = datetime.timedelta(minutes=int(request.params["date-tz"])) date = datetime.datetime.fromisoformat(request.params["date"]) - track.date = date.replace(tzinfo=datetime.timezone(tz_offset)) - - track.tagged_people = tagged_people - track.title = request.params["title"] - track.visibility = Visibility[request.params["visibility"]] - track.type = TrackType[request.params["type"]] - track.description = request.params["description"] - track.badges = badges - tags = request.params.getall("tag[]") - track.sync_tags(tags) - - edit_images(request, request.context) + with data.lock(): + track.date = date.replace(tzinfo=datetime.timezone(tz_offset)) + + track.tagged_people = tagged_people + track.title = request.params["title"] + track.visibility = Visibility[request.params["visibility"]] + track.type = TrackType[request.params["type"]] + track.description = request.params["description"] + track.badges = badges + tags = request.params.getall("tag[]") + track.sync_tags(tags) + + edit_images(request, request.context) return HTTPFound(request.route_url("details", track_id=track.id)) |