forked from superdesk/superdesk-planning
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDBELGA-884] fix: Only copy configured custom CVs from Event to Plan…
…ning Also fix bug with validating subject field (removing the `allowed` field for scheme)
- Loading branch information
1 parent
ae9e2bd
commit cb8ddf0
Showing
8 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
server/planning/data_updates/00034_20240920-141321_planning_types.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# -*- coding: utf-8; -*- | ||
# This file is part of Superdesk. | ||
# For the full copyright and license information, please see the | ||
# AUTHORS and LICENSE files distributed with this source code, or | ||
# at https://www.sourcefabric.org/superdesk/license | ||
# | ||
# Author : MarkLark86 | ||
# Creation: 2024-09-20 14:13 | ||
|
||
from superdesk.commands.data_updates import BaseDataUpdate | ||
|
||
|
||
class DataUpdate(BaseDataUpdate): | ||
resource = "planning_types" | ||
|
||
def forwards(self, mongodb_collection, mongodb_database): | ||
for resource_type in ["event", "planning"]: | ||
original_profile = mongodb_collection.find_one({"name": resource_type}) | ||
if not original_profile: | ||
# No need to process this Profile if the defaults are currently used | ||
continue | ||
|
||
try: | ||
schema = original_profile["schema"] | ||
schema["subject"]["schema"]["schema"]["scheme"].pop("allowed", None) | ||
except (KeyError, TypeError): | ||
# ``subject`` or ``allowed`` is not currently set, no need to fix it | ||
continue | ||
|
||
mongodb_collection.update({"name": resource_type}, {"$set": {"schema": schema}}) | ||
|
||
def backwards(self, mongodb_collection, mongodb_database): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters