Add support for new-style corporal install command

This commit is contained in:
Lance Edgar 2023-01-18 14:37:55 -06:00
parent 761069f0dd
commit 51222667b3
7 changed files with 13 additions and 152 deletions

View file

@ -28,12 +28,16 @@ class Command(commands.Command):
long_description = ''
class HelloWorld(commands.Subcommand):
class Install(commands.InstallSubcommand):
"""
The requisite 'hello world' example
Install the Corporal app
"""
name = 'hello'
name = 'install'
description = __doc__.strip()
def run(self, args):
self.stdout.write("hello world!\n")
# nb. these must be explicitly set b/c config is not available
# when running normally, e.g. `corporal -n install`
app_title = "Corporal"
app_package = 'corporal'
app_eggname = 'Corporal'
app_pypiname = 'Corporal'

View file

@ -19,7 +19,6 @@ class CorporalConfig(ConfigExtension):
# set some default config values
config.setdefault('rattail', 'model', 'corporal.db.model')
config.setdefault('rattail', 'settings', 'corporal.settings')
config.setdefault('tailbone.menus', 'handler', 'corporal.web.menus:CorporalMenuHandler')
config.setdefault('rattail.config', 'templates', 'corporal:data/config rattail:data/config')

View file

@ -1,28 +0,0 @@
# -*- coding: utf-8; -*-
"""
App Settings
"""
from rattail.settings import Setting
# bring in some common settings from rattail
from rattail.settings import (
# (General)
rattail_app_title,
tailbone_background_color,
tailbone_grid_default_pagesize,
# Email
rattail_mail_record_attempts,
# Product
rattail_product_key,
rattail_product_key_title,
tailbone_products_show_pod_image,
# Purchasing / Receiving
rattail_batch_purchase_allow_cases,
rattail_batch_purchase_allow_expired_credits,
)

View file

@ -33,92 +33,9 @@ class CorporalMenuHandler(base.MenuHandler):
],
}
reports_menu = {
'title': "Reports",
'type': 'menu',
'items': [
{
'title': "New Report",
'route': 'report_output.create',
'perm': 'report_output.create',
},
{
'title': "Generated Reports",
'route': 'report_output',
'perm': 'report_output.list',
},
{
'title': "Problem Reports",
'route': 'problem_reports',
'perm': 'problem_reports.list',
},
{'type': 'sep'},
{
'title': "Poser Reports",
'route': 'poser_reports',
'perm': 'poser_reports.list',
},
],
}
reports_menu = self.make_reports_menu(request, include_poser=True)
admin_menu = {
'title': "Admin",
'type': 'menu',
'items': [
{
'title': "Users",
'route': 'users',
'perm': 'users.list',
},
{
'title': "User Events",
'route': 'userevents',
'perm': 'userevents.list',
},
{
'title': "Roles",
'route': 'roles',
'perm': 'roles.list',
},
{'type': 'sep'},
{
'title': "App Settings",
'route': 'appsettings',
'perm': 'settings.list',
},
{
'title': "Email Settings",
'route': 'emailprofiles',
'perm': 'emailprofiles.list',
},
{
'title': "Email Attempts",
'route': 'email_attempts',
'perm': 'email_attempts.list',
},
{
'title': "Raw Settings",
'route': 'settings',
'perm': 'settings.list',
},
{'type': 'sep'},
{
'title': "Tables",
'route': 'tables',
'perm': 'tables.list',
},
{
'title': "Importing / Exporting",
'route': 'importing',
'perm': 'importing.runjobs',
},
{
'title': "Corporal Upgrades",
'route': 'upgrades',
'perm': 'upgrades.list',
},
],
}
admin_menu = self.make_admin_menu(request, include_stores=False)
menus = [
corepos_menu,

View file

@ -7,21 +7,8 @@ Corporal Views
def includeme(config):
# core views
config.include('corporal.web.views.common')
config.include('tailbone.views.auth')
config.include('tailbone.views.tables')
config.include('tailbone.views.upgrades')
config.include('tailbone.views.progress')
config.include('tailbone.views.importing')
config.include('tailbone.views.essentials')
config.include('tailbone.views.poser')
config.include('tailbone.views.reports')
# main table views
config.include('tailbone.views.email')
config.include('tailbone.views.people')
config.include('tailbone.views.roles')
config.include('tailbone.views.settings')
config.include('tailbone.views.users')
# main views for CORE-POS
config.include('tailbone_corepos.views')

View file

@ -1,18 +0,0 @@
# -*- coding: utf-8; -*-
"""
Common views
"""
from tailbone.views import common as base
import corporal
class CommonView(base.CommonView):
project_title = "Corporal"
project_version = corporal.__version__ + '+dev'
def includeme(config):
CommonView.defaults(config)

View file

@ -99,7 +99,7 @@ setup(
],
'corporal.commands': [
'hello = corporal.commands:HelloWorld',
'install = corporal.commands:Install',
],
'paste.app_factory': [