# Path: pages/templatetags/pages_tags.py
# @register.assignment_tag(takes_context=True)
# def get_page_object_by_id(context, object_type, oid):
#     """
#     **Arguments**
# 
#     ``object_type``
#         object type
# 
#     ``oid``
#         id for object selection
# 
#     :return selected object
#     """
#     if type(oid) != int:
#         raise template.TemplateSyntaxError('page_object_by_id tag requires a integer argument')
# 
#     selected_object = None
# 
#     try:
#         try:
#             for obj in context['page']['content'][object_type]:
#                 sid = '{0:>s}:{1:>s}:{2:>s}:{3:>d}'.format(
#                     obj.language, context['page']['page'].name, obj.type, oid
#                 )
#                 if obj.sid == sid:
#                     selected_object = obj
#                     break
#         except TypeError:
#             pass
#     except KeyError:
#         try:
#             try:
#                 for obj in context['page']['ext_content'][object_type]:
#                     sid = '{0:>s}:{1:>s}:{2:>s}:{3:>d}'.format(
#                         obj.language, context['page']['page'].name, obj.type, oid
#                     )
#                     if obj.sid == sid:
#                         selected_object = obj
#                         break
#             except TypeError:
#                 pass
#         except KeyError:
#             raise template.TemplateSyntaxError('wrong content type: {0:>s}'.format(object_type))
#     return selected_object


from django import template
from pages.templatetags.pages_tags import get_page_object_by_id


register = template.Library()


@register.simple_tag(takes_context=True)
def page_video_by_id(context, oid):

# Path: pages/templatetags/pages_tags.py
# @register.assignment_tag(takes_context=True)
# def get_page_object_by_id(context, object_type, oid):
#     """
#     **Arguments**
# 
#     ``object_type``
#         object type
# 
#     ``oid``
#         id for object selection
# 
#     :return selected object
#     """
#     if type(oid) != int:
#         raise template.TemplateSyntaxError('page_object_by_id tag requires a integer argument')
# 
#     selected_object = None
# 
#     try:
#         try:
#             for obj in context['page']['content'][object_type]:
#                 sid = '{0:>s}:{1:>s}:{2:>s}:{3:>d}'.format(
#                     obj.language, context['page']['page'].name, obj.type, oid
#                 )
#                 if obj.sid == sid:
#                     selected_object = obj
#                     break
#         except TypeError:
#             pass
#     except KeyError:
#         try:
#             try:
#                 for obj in context['page']['ext_content'][object_type]:
#                     sid = '{0:>s}:{1:>s}:{2:>s}:{3:>d}'.format(
#                         obj.language, context['page']['page'].name, obj.type, oid
#                     )
#                     if obj.sid == sid:
#                         selected_object = obj
#                         break
#             except TypeError:
#                 pass
#         except KeyError:
#             raise template.TemplateSyntaxError('wrong content type: {0:>s}'.format(object_type))
#     return selected_object


# Path: docs/example_app/extpages/templatetags/extpages_tags.py
from django import template
from pages.templatetags.pages_tags import get_page_object_by_id



register = template.Library()


@register.simple_tag(takes_context=True)
def page_video_by_id(context, oid):

    obj = get_page_object_by_id(context, 'video', oid)