コード例 #1
0
ファイル: views.py プロジェクト: tbsschroeder/dbas
def main_table(request):
    """
    View configuration for the content view. Only logged in user can reach this page.

    :param request: current webservers request
    :return: dictionary with title and project name as well as a value, weather the user is logged in
    """
    LOG.debug("Entering the main_table method from the admin interface.")

    ui_locales = get_language_from_cookie(request)
    extras_dict = DictionaryHelper(
        ui_locales).prepare_extras_dict_for_normal_page(
            request.registry, request.application_url, request.path,
            request.validated['user'])
    table_name = request.matchdict['table']
    if not table_name.lower() in lib.table_mapper:
        return exception_response(400)
    table_dict = lib.get_table_dict(table_name, request.application_url)

    return {
        'language': str(ui_locales),
        'title': 'Admin - ' + table_name,
        'project': project_name,
        'extras': extras_dict,
        'table': table_dict,
        'discussion': {
            'broke_limit': False
        }
    }
コード例 #2
0
 def test_get_table_dict(self):
     for table in admin.table_mapper:
         return_dict = admin.get_table_dict(
             admin.table_mapper[table]['name'], 'some_main_page')
         self.assertIn('name', return_dict)
         self.assertNotIn('password', return_dict)
         self.assertNotIn('token', return_dict)
         self.assertNotIn('token_timestamp', return_dict)