# Path: turbo/conf.py
# class ObjectDict(dict):
# class AppConfig(object):
#     def __getattr__(self, name):
#         def __setattr__(self, name, value):
#     def __init__(self):
#     def log_level(self):


import re
import functools
from turbo.conf import app_config
    from jinja2 import Environment, FileSystemLoader
            template ../header.html
            parent app/app/index.html
        output:
            app/header.html

    """

    relative_path = re.compile('(./|../)', re.IGNORECASE)
    relative_dir = re.compile('([^/\s]{1,}/)', re.IGNORECASE)
    real_name = re.compile('([^/\s]{1,}$)')

    def join_path(self, template, parent):
        t_group = self.relative_path.findall(template)
        p_group = self.relative_dir.findall(parent)

        t_group_length = len(t_group)
        template_name = template
        #
        real_template_path = p_group
        if t_group_length:
            template_name = self.real_name.match(
                template, template.rfind('/') + 1).group()
            real_template_path = p_group[0:0 - t_group_length]

        real_template_path.append(template_name)
        return ''.join(real_template_path)


def turbo_jinja2(func):
    _jinja2_env = Jinja2Environment(loader=FileSystemLoader(app_config.web_application_setting[

# Path: turbo/conf.py
# class ObjectDict(dict):
# class AppConfig(object):
#     def __getattr__(self, name):
#         def __setattr__(self, name, value):
#     def __init__(self):
#     def log_level(self):


# Path: turbo/template.py
import re
import functools
from turbo.conf import app_config
    from jinja2 import Environment, FileSystemLoader

            template ../header.html
            parent app/app/index.html
        output:
            app/header.html

    """

    relative_path = re.compile('(./|../)', re.IGNORECASE)
    relative_dir = re.compile('([^/\s]{1,}/)', re.IGNORECASE)
    real_name = re.compile('([^/\s]{1,}$)')

    def join_path(self, template, parent):
        t_group = self.relative_path.findall(template)
        p_group = self.relative_dir.findall(parent)

        t_group_length = len(t_group)
        template_name = template
        #
        real_template_path = p_group
        if t_group_length:
            template_name = self.real_name.match(
                template, template.rfind('/') + 1).group()
            real_template_path = p_group[0:0 - t_group_length]

        real_template_path.append(template_name)
        return ''.join(real_template_path)


def turbo_jinja2(func):
    _jinja2_env = Jinja2Environment(loader=FileSystemLoader(app_config.web_application_setting[

                                    'template_path']), auto_reload=app_config.web_application_setting['debug'])