# Path: rtei/models.py
# def get_chart_labels(indicators, themes):
# def get_map_context(context, year):
# def get_country_context(context, country_code, year):
# def get_theme_context(context, year):
#     def get_context(self, request):
#     def get_template(self, request, *args, **kwargs):
#     def get_context(self, request):
#     def serve(self, request):
#     def get_template(self, request, *args, **kwargs):
#     def resources(self):
#     def years(self, resources):
#     def countries(self, resources):
#     def collections(self, resources):
#     def get_context(self, request):
#     def blogs(self):
#     def get_context(self, request):
#     def blog_index(self):
# class RTEIPage(Page):
# class RTEIAncillaryPage(Page):
# class ResourceIndexPage(Page):
# class RteiDocument(AbstractDocument, index.Indexed):
#     class Meta:
# class BlogIndexPage(Page):
# class BlogPageTag(TaggedItemBase):
# class BlogPage(Page):
# 
# Path: rtei/data.py
# def get_file_path(file_name, year=''):
#     return os.path.join(
#         os.path.dirname(__file__),
#         'static', 'data',
#         year,
#         file_name)


import os
import logging
from django import template
from django.utils.translation import ugettext as _, get_language
from rtei.models import Page, RTEIAncillaryPage, BlogPage
from rtei.data import get_file_path
    # Get the root About page (either the parent or self of calling_page)
    parent = calling_page.get_parent()
    if parent.specific_class is calling_page.specific_class:
        about_root = parent
    else:
        about_root = calling_page

    base_menu_items = about_root.get_children().live().in_menu()
    menu_items = []
    for base_menu_item in base_menu_items:
        menu_item = base_menu_item.specific

        menu_item.active = (
            calling_page.url.startswith(menu_item.url)
            if calling_page else False)

        menu_items.append(menu_item)
    return {
        'calling_page': calling_page,
        'menu_items': menu_items,
        # required by the pageurl tag that we want to use within this template
        'request': context['request'],
    }


@register.assignment_tag()
def translated_field(obj, field, lang):
    if lang != 'en':
        field_name = '{0}_{1}'.format(field, lang)
        if hasattr(obj, field_name) and getattr(obj, field_name):

# Path: rtei/models.py
# def get_chart_labels(indicators, themes):
# def get_map_context(context, year):
# def get_country_context(context, country_code, year):
# def get_theme_context(context, year):
#     def get_context(self, request):
#     def get_template(self, request, *args, **kwargs):
#     def get_context(self, request):
#     def serve(self, request):
#     def get_template(self, request, *args, **kwargs):
#     def resources(self):
#     def years(self, resources):
#     def countries(self, resources):
#     def collections(self, resources):
#     def get_context(self, request):
#     def blogs(self):
#     def get_context(self, request):
#     def blog_index(self):
# class RTEIPage(Page):
# class RTEIAncillaryPage(Page):
# class ResourceIndexPage(Page):
# class RteiDocument(AbstractDocument, index.Indexed):
#     class Meta:
# class BlogIndexPage(Page):
# class BlogPageTag(TaggedItemBase):
# class BlogPage(Page):
# 
# Path: rtei/data.py
# def get_file_path(file_name, year=''):
#     return os.path.join(
#         os.path.dirname(__file__),
#         'static', 'data',
#         year,
#         file_name)


# Path: rtei/templatetags/rtei_tags.py
import os
import logging
from django import template
from django.utils.translation import ugettext as _, get_language
from rtei.models import Page, RTEIAncillaryPage, BlogPage
from rtei.data import get_file_path

    # Get the root About page (either the parent or self of calling_page)
    parent = calling_page.get_parent()
    if parent.specific_class is calling_page.specific_class:
        about_root = parent
    else:
        about_root = calling_page

    base_menu_items = about_root.get_children().live().in_menu()
    menu_items = []
    for base_menu_item in base_menu_items:
        menu_item = base_menu_item.specific

        menu_item.active = (
            calling_page.url.startswith(menu_item.url)
            if calling_page else False)

        menu_items.append(menu_item)
    return {
        'calling_page': calling_page,
        'menu_items': menu_items,
        # required by the pageurl tag that we want to use within this template
        'request': context['request'],
    }


@register.assignment_tag()
def translated_field(obj, field, lang):
    if lang != 'en':
        field_name = '{0}_{1}'.format(field, lang)
        if hasattr(obj, field_name) and getattr(obj, field_name):

            return getattr(obj, field_name)