Initial commit, re-branded from first attempt..

This commit is contained in:
Lance Edgar 2022-03-02 16:41:28 -06:00
commit 7058ebf75e
17 changed files with 871 additions and 0 deletions

0
messkit/web/__init__.py Normal file
View file

54
messkit/web/app.py Normal file
View file

@ -0,0 +1,54 @@
# -*- coding: utf-8; -*-
######################################################################
#
# messkit -- Generic-ish Data Utility App
# Copyright © 2022 Lance Edgar
#
# This file is part of messkit.
#
# messkit is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# messkit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with messkit. If not, see <http://www.gnu.org/licenses/>.
#
######################################################################
"""
messkit web app
"""
from tailbone import app
def main(global_config, **settings):
"""
This function returns a Pyramid WSGI application.
"""
# prefer messkit templates over Tailbone
settings.setdefault('mako.directories', ['messkit.web:templates',
'tailbone:templates',])
# for graceful handling of postgres restart
settings.setdefault('retry.attempts', 2)
# make config objects
rattail_config = app.make_rattail_config(settings)
pyramid_config = app.make_pyramid_config(settings)
# bring in the rest of messkit
pyramid_config.include('messkit.web.static')
pyramid_config.include('messkit.web.subscribers')
pyramid_config.include('messkit.web.views')
# for graceful handling of postgres restart
pyramid_config.add_tween('tailbone.tweens.sqlerror_tween_factory',
under='pyramid_tm.tm_tween_factory')
return pyramid_config.make_wsgi_app()

140
messkit/web/menus.py Normal file
View file

@ -0,0 +1,140 @@
# -*- coding: utf-8; -*-
######################################################################
#
# messkit -- Generic-ish Data Utility App
# Copyright © 2022 Lance Edgar
#
# This file is part of messkit.
#
# messkit is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# messkit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with messkit. If not, see <http://www.gnu.org/licenses/>.
#
######################################################################
"""
Web Menus
"""
def simple_menus(request):
url = request.route_url
# reports_menu = {
# 'title': "Reports",
# 'type': 'menu',
# 'items': [
# {
# 'title': "New Report",
# 'url': url('report_output.create'),
# 'perm': 'report_output.create',
# },
# {
# 'title': "Generated Reports",
# 'url': url('report_output'),
# 'perm': 'report_output.list',
# },
# {
# 'title': "Problem Reports",
# 'url': url('problem_reports'),
# 'perm': 'problem_reports.list',
# },
# ],
# }
# other_menu = {
# 'title': "Other",
# 'type': 'menu',
# 'items': [
# {
# 'title': "Generate New Feature",
# 'url': url('generate_feature'),
# 'perm': 'common.generate_feature',
# },
# {
# 'title': "Generate New Project",
# 'url': url('generate_project'),
# 'perm': 'common.generate_project',
# },
# ],
# }
admin_menu = {
'title': "Admin",
'type': 'menu',
'items': [
{
'title': "Users",
'url': url('users'),
'perm': 'users.list',
},
# {
# 'title': "User Events",
# 'url': url('userevents'),
# 'perm': 'userevents.list',
# },
{
'title': "Roles",
'url': url('roles'),
'perm': 'roles.list',
},
{'type': 'sep'},
{
'title': "App Settings",
'url': url('appsettings'),
'perm': 'settings.list',
},
{
'title': "Email Settings",
'url': url('emailprofiles'),
'perm': 'emailprofiles.list',
},
# {
# 'title': "Email Attempts",
# 'url': url('email_attempts'),
# 'perm': 'email_attempts.list',
# },
{
'title': "Raw Settings",
'url': url('settings'),
'perm': 'settings.list',
},
{'type': 'sep'},
# {
# 'title': "DataSync Changes",
# 'url': url('datasyncchanges'),
# 'perm': 'datasync_changes.list',
# },
# {
# 'title': "Importing / Exporting",
# 'url': url('importing'),
# 'perm': 'importing.list',
# },
{
'title': "Tables",
'url': url('tables'),
'perm': 'tables.list',
},
{
'title': "messkit Upgrades",
'url': url('upgrades'),
'perm': 'upgrades.list',
},
],
}
menus = [
# reports_menu,
# other_menu,
admin_menu,
]
return menus

View file

@ -0,0 +1,30 @@
# -*- coding: utf-8; -*-
######################################################################
#
# messkit -- Generic-ish Data Utility App
# Copyright © 2022 Lance Edgar
#
# This file is part of messkit.
#
# messkit is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# messkit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with messkit. If not, see <http://www.gnu.org/licenses/>.
#
######################################################################
"""
messkit static assets
"""
def includeme(config):
config.include('tailbone.static')
config.add_static_view('messkit', 'messkit.web:static', cache_max_age=3600)

View file

@ -0,0 +1,37 @@
# -*- coding: utf-8; -*-
######################################################################
#
# messkit -- Generic-ish Data Utility App
# Copyright © 2022 Lance Edgar
#
# This file is part of messkit.
#
# messkit is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# messkit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with messkit. If not, see <http://www.gnu.org/licenses/>.
#
######################################################################
"""
Pyramid event subscribers
"""
import messkit
def add_messkit_to_context(event):
renderer_globals = event
renderer_globals['messkit'] = messkit
def includeme(config):
config.include('tailbone.subscribers')
config.add_subscriber(add_messkit_to_context, 'pyramid.events.BeforeRender')

View file

@ -0,0 +1,49 @@
# -*- coding: utf-8; -*-
######################################################################
#
# messkit -- Generic-ish Data Utility App
# Copyright © 2022 Lance Edgar
#
# This file is part of messkit.
#
# messkit is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# messkit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with messkit. If not, see <http://www.gnu.org/licenses/>.
#
######################################################################
"""
messkit web views
"""
def includeme(config):
# core
config.include('messkit.web.views.common')
config.include('tailbone.views.auth')
config.include('tailbone.views.menus')
# config.include('tailbone.views.importing')
config.include('tailbone.views.poser')
config.include('tailbone.views.progress')
# config.include('tailbone.views.features')
config.include('tailbone.views.reports')
# main tables
config.include('tailbone.views.email')
config.include('tailbone.views.people')
config.include('tailbone.views.roles')
config.include('tailbone.views.settings')
config.include('tailbone.views.tables')
config.include('tailbone.views.upgrades')
config.include('tailbone.views.users')

View file

@ -0,0 +1,39 @@
# -*- coding: utf-8; -*-
######################################################################
#
# messkit -- Generic-ish Data Utility App
# Copyright © 2022 Lance Edgar
#
# This file is part of messkit.
#
# messkit is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# messkit is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with messkit. If not, see <http://www.gnu.org/licenses/>.
#
######################################################################
"""
Common views
"""
from tailbone.views import common as base
import messkit
class CommonView(base.CommonView):
project_title = "messkit"
project_version = messkit.__version__ + '+dev'
def includeme(config):
CommonView.defaults(config)