# Path: ringo/lib/helpers/appinfo.py
# def get_ringo_version():
#     return pkg_resources.get_distribution('ringo').version
# 
# def get_app_name():
#     registry = get_current_registry()
#     return registry.__name__
# 
# def get_app_version():
#     return pkg_resources.get_distribution(get_app_name()).version
# 
# def get_app_title():
#     """Will return the title of the application
# 
#     :return: The title of the application"""
#     registry = get_current_registry()
#     settings = registry.settings
#     return settings['app.title']
# 
# Path: ringo/lib/renderer/lists.py
# class DTListRenderer(object):
#     """Docstring for a ListRenderer using the DataTables Jquery Plugin"""
#     def __init__(self, listing, tablename=None):
#         self.listing = listing
#         self.config = get_table_config(self.listing.clazz, tablename)
#         self.template = template_lookup.get_template("internal/dtlist.mako")
# 
#         # Template for JS datatable configuration
#         self.js_template = template_lookup.get_template("internal/dtlist.js.mako")
# 
#     def _get_table_id(self):
#         table_id = ["dt",
#                     self.config.clazz.__tablename__,
#                     self.config.name]
#         table_id = "_".join(table_id)
#         return table_id
# 
#     def _render_js_config(self, request, table_id, bundled_actions):
#         values = {'tableconfig': self.config,
#                   'table_id': table_id,
#                   'request': request,
#                   'bundled_actions': bundled_actions,
#                   '_': request.translate}
#         return self.js_template.render(**values)
# 
#     def render(self, request):
#         """Initialize renderer"""
# 
#         # Get the bundles_actions.
#         # If bundle_actions is True, display checkboxes and more in the table.
#         bundled_actions = []
#         for action in get_item_actions(request, self.listing.clazz):
#             if action.bundle and security.has_permission(action.name.lower(),
#                                                          request.context,
#                                                          request):
#                 bundled_actions.append(action)
#         table_id = self._get_table_id()
#         table_config = self._render_js_config(request,
#                                               table_id,
#                                               bundled_actions)
#         values = {'items': self.listing.items,
#                   'clazz': self.listing.clazz,
#                   'listing': self.listing,
#                   'request': request,
#                   '_': request.translate,
#                   's': security,
#                   'h': ringo.lib.helpers,
#                   'bundled_actions': bundled_actions,
#                   'tableconfig': self.config,
#                   'tableid': table_id,
#                   'dtconfig': table_config}
#         return literal(self.template.render(**values))


import pkg_resources
from pyramid.view import view_config
from ringo.lib.helpers import (
    get_ringo_version,
    get_app_version,
    get_app_name,
    get_app_title
)
from ringo.lib.renderer import (
    DTListRenderer
)




@view_config(route_name='home', renderer='/index.mako')
def index_view(request):
    values = {}
    return values


@view_config(route_name='about', renderer='/about.mako')
def about_view(request):
    values = {}
    values['app_title'] = get_app_title()
    return values


@view_config(route_name='contact', renderer='/contact.mako')
def contact_view(request):
    return {}


@view_config(route_name='version', renderer='/version.mako')
def version_view(request):
    # Fetch the versions of some Packages
    # Ringo
    values = {}
    formbar_pkg = pkg_resources.get_distribution('formbar')
    sqla_pkg = pkg_resources.get_distribution('sqlalchemy')
    pyramid_pkg = pkg_resources.get_distribution('pyramid')

# Path: ringo/lib/helpers/appinfo.py
# def get_ringo_version():
#     return pkg_resources.get_distribution('ringo').version
# 
# def get_app_name():
#     registry = get_current_registry()
#     return registry.__name__
# 
# def get_app_version():
#     return pkg_resources.get_distribution(get_app_name()).version
# 
# def get_app_title():
#     """Will return the title of the application
# 
#     :return: The title of the application"""
#     registry = get_current_registry()
#     settings = registry.settings
#     return settings['app.title']
# 
# Path: ringo/lib/renderer/lists.py
# class DTListRenderer(object):
#     """Docstring for a ListRenderer using the DataTables Jquery Plugin"""
#     def __init__(self, listing, tablename=None):
#         self.listing = listing
#         self.config = get_table_config(self.listing.clazz, tablename)
#         self.template = template_lookup.get_template("internal/dtlist.mako")
# 
#         # Template for JS datatable configuration
#         self.js_template = template_lookup.get_template("internal/dtlist.js.mako")
# 
#     def _get_table_id(self):
#         table_id = ["dt",
#                     self.config.clazz.__tablename__,
#                     self.config.name]
#         table_id = "_".join(table_id)
#         return table_id
# 
#     def _render_js_config(self, request, table_id, bundled_actions):
#         values = {'tableconfig': self.config,
#                   'table_id': table_id,
#                   'request': request,
#                   'bundled_actions': bundled_actions,
#                   '_': request.translate}
#         return self.js_template.render(**values)
# 
#     def render(self, request):
#         """Initialize renderer"""
# 
#         # Get the bundles_actions.
#         # If bundle_actions is True, display checkboxes and more in the table.
#         bundled_actions = []
#         for action in get_item_actions(request, self.listing.clazz):
#             if action.bundle and security.has_permission(action.name.lower(),
#                                                          request.context,
#                                                          request):
#                 bundled_actions.append(action)
#         table_id = self._get_table_id()
#         table_config = self._render_js_config(request,
#                                               table_id,
#                                               bundled_actions)
#         values = {'items': self.listing.items,
#                   'clazz': self.listing.clazz,
#                   'listing': self.listing,
#                   'request': request,
#                   '_': request.translate,
#                   's': security,
#                   'h': ringo.lib.helpers,
#                   'bundled_actions': bundled_actions,
#                   'tableconfig': self.config,
#                   'tableid': table_id,
#                   'dtconfig': table_config}
#         return literal(self.template.render(**values))


# Path: ringo/views/home.py
import pkg_resources
from pyramid.view import view_config
from ringo.lib.helpers import (
    get_ringo_version,
    get_app_version,
    get_app_name,
    get_app_title
)
from ringo.lib.renderer import (
    DTListRenderer
)





@view_config(route_name='home', renderer='/index.mako')
def index_view(request):
    values = {}
    return values


@view_config(route_name='about', renderer='/about.mako')
def about_view(request):
    values = {}
    values['app_title'] = get_app_title()
    return values


@view_config(route_name='contact', renderer='/contact.mako')
def contact_view(request):
    return {}


@view_config(route_name='version', renderer='/version.mako')
def version_view(request):
    # Fetch the versions of some Packages
    # Ringo
    values = {}
    formbar_pkg = pkg_resources.get_distribution('formbar')
    sqla_pkg = pkg_resources.get_distribution('sqlalchemy')
    pyramid_pkg = pkg_resources.get_distribution('pyramid')

    values['app_title'] = get_app_title()