# Path: helpers/sessions.py
# class SessionHandler(RequestHandler):
# 
#     # Override dispatch method to get and save session data with every request
#     def dispatch(self):
#         self.session_store = get_store(request=self.request)
#         try:
#             RequestHandler.dispatch(self)
#         finally:
#             self.session_store.save_sessions(self.response)
# 
#     # Make session data available within handlers
#     @cached_property
#     def session(self):
#         return self.session_store.get_session()
# 
#     def current_user(self, user=None):
#         if user:
#             self.session['current_user'] = user.google_id
# 
#         if 'current_user' in self.session:
#             return User.get_by_google_id(self.session['current_user'])
#         else:
#             return None
# 
# Path: helpers/views.py
# def render(template_file, template_data={}, ):
#     template = APP_RENDER.get_template(template_file)
#     template_data['VERSION'] = main.__version__
#     return template.render(template_data)


from helpers.sessions import SessionHandler
from helpers.views import render
# -*- coding: utf-8 -*-
#
# Dashboard route handlers
#


class MainRoute(SessionHandler):

    def get(self):
        if self.current_user():

# Path: helpers/sessions.py
# class SessionHandler(RequestHandler):
# 
#     # Override dispatch method to get and save session data with every request
#     def dispatch(self):
#         self.session_store = get_store(request=self.request)
#         try:
#             RequestHandler.dispatch(self)
#         finally:
#             self.session_store.save_sessions(self.response)
# 
#     # Make session data available within handlers
#     @cached_property
#     def session(self):
#         return self.session_store.get_session()
# 
#     def current_user(self, user=None):
#         if user:
#             self.session['current_user'] = user.google_id
# 
#         if 'current_user' in self.session:
#             return User.get_by_google_id(self.session['current_user'])
#         else:
#             return None
# 
# Path: helpers/views.py
# def render(template_file, template_data={}, ):
#     template = APP_RENDER.get_template(template_file)
#     template_data['VERSION'] = main.__version__
#     return template.render(template_data)


# Path: controllers/dashboard.py
from helpers.sessions import SessionHandler
from helpers.views import render

# -*- coding: utf-8 -*-
#
# Dashboard route handlers
#


class MainRoute(SessionHandler):

    def get(self):
        if self.current_user():

            data = {'session': self.session, 'current_user': self.current_user().to_dict()}