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

WIP Hack in three lvls #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,28 @@ def serialize_data(json_data, show_children=False):
# serializer doesn't return uid
summary["UID"] = uid
if show_children:
summary["items"] = get_item_children(item)
lvl1_items = get_item_children(item)
# Subitems
lvl1_all = []
for lvl1_item in lvl1_items:
server_url = request.get('SERVER_URL','')
lvl1_item_path = lvl1_item['@id'].replace(server_url,'')
try:
item_obj = api.content.get(path=lvl1_item_path)
except Unauthorized:
# private item and user can't see it
continue
if not item_obj:
continue
lvl1_summary = getMultiAdapter(
(item_obj, request), ISerializeToJsonSummary
)()
if lvl1_summary:
# serializer doesn't return uid
lvl1_summary["UID"] = api.content.get_uuid(obj=item_obj)
lvl1_summary["items"] = get_item_children(item_obj)
lvl1_all.append(lvl1_summary)
summary["items"] = lvl1_all
serialized.append(summary)
tab[key] = serialized
fix_blocks(tab)
Expand Down