File tree 1 file changed +8
-7
lines changed
openedx/core/djangoapps/content/search
1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -267,6 +267,13 @@ def _collections_for_content_object(object_id: UsageKey | LearningContextKey) ->
267
267
}
268
268
269
269
"""
270
+ result = {
271
+ Fields .collections : {
272
+ Fields .collections_display_name : [],
273
+ Fields .collections_key : [],
274
+ }
275
+ }
276
+
270
277
# Gather the collections associated with this object
271
278
collections = None
272
279
try :
@@ -279,14 +286,8 @@ def _collections_for_content_object(object_id: UsageKey | LearningContextKey) ->
279
286
log .warning (f"No component found for { object_id } " )
280
287
281
288
if not collections :
282
- return { Fields . collections : {}}
289
+ return result
283
290
284
- result = {
285
- Fields .collections : {
286
- Fields .collections_display_name : [],
287
- Fields .collections_key : [],
288
- }
289
- }
290
291
for collection in collections :
291
292
result [Fields .collections ][Fields .collections_display_name ].append (collection .title )
292
293
result [Fields .collections ][Fields .collections_key ].append (collection .key )
You can’t perform that action at this time.
0 commit comments