$def with (work, edition, link_text, id, classes='') $ username = ctx.user and ctx.user.key.split('/')[-1] $ has_edition = edition is not None $ notes = work.get_users_notes(username) if not has_edition else work.get_users_notes(username, edition.key.split('/')[-1]) $ book_descriptor = _("work") $ i18n_strings = { $ "close_text": _("Close"), $ "submit_text": _("Submit") $ } $ context = { $ "username": username, $ "work": work.key, $ "id": id $ } $if has_edition: $ context["edition"] = edition.key $ book_descriptor = _("edition")