Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pls adapt the NINJS outputformatter to provide better references for all renditions [SDCP-723] #2489

Merged
merged 10 commits into from
Nov 16, 2023
1 change: 1 addition & 0 deletions superdesk/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ def local_to_utc_hour(hour):
},
}

NINJS_COMMON_RENDITIONS = list(RENDITIONS["picture"].keys())

#: BCRYPT work factor
BCRYPT_GENSALT_WORK_FACTOR = 12
Expand Down
4 changes: 2 additions & 2 deletions superdesk/io/feed_parsers/ninjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def _transform_from_ninjs(self, ninjs):
associated_item["versioncreated"] = self.datetime(associated_item["versioncreated"])
item["associations"][key] = deepcopy(associated_item)

if ninjs.get("renditions", {}).get("baseImage"):
item["renditions"] = {"baseImage": {"href": ninjs.get("renditions", {}).get("original", {}).get("href")}}
if ninjs.get("renditions"):
item["renditions"] = ninjs["renditions"]
devketanpro marked this conversation as resolved.
Show resolved Hide resolved

if ninjs.get("located"):
item["dateline"] = {"located": {"city": ninjs.get("located")}}
Expand Down
2 changes: 1 addition & 1 deletion superdesk/publish/formatters/ninjs_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def __init__(self):
self.format_type = "ninjs"
self.can_preview = True
self.can_export = True
self.internal_renditions = ["original"]
self.internal_renditions = app.config.get("NINJS_COMMON_RENDITIONS", []) + ["original"]

def format(self, article, subscriber, codes=None):
try:
Expand Down
Loading