def tnc_settings(): from kotti import _resolve_dotted from kotti import conf_defaults settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['pyramid.includes'] += ''' tnc_theme.views.timeline tnc_theme.views.persons tnc_theme.views.quotes tnc_theme.views.views pyramid_snippets tnc_theme.snippets tnc_theme.widgets kotti_blog.views''' settings['kotti.available_types'] += ''' tnc_theme.resources.Persons tnc_theme.resources.Persons tnc_theme.resources.Person tnc_theme.resources.Institutions tnc_theme.resources.Institution tnc_theme.resources.Quote tnc_theme.resources.SecureDocument tnc_theme.resources.TimelineFolder tnc_theme.resources.TimelineMilestone tnc_theme.resources.TimelineContent kotti_blog.resources.Blog kotti_blog.resources.BlogEntry''' settings['kotti.asset_overrides'] += ' tnc_theme:kotti-overrides/' settings['kotti.populators'] = 'tnc_theme.populate.populate' settings['kotti.templates.api'] = 'tnc_theme.utils.TncTemplateAPI' settings['kotti.alembic_dirs'] += ' tnc_theme:alembic' # settings['kotti.root_factory'] = 'tnc_theme.utils.get_root' settings['kotti.use_workflow'] = 'tnc_theme:workflow.zcml' _resolve_dotted(settings) return settings
def settings(): from kotti import _resolve_dotted from kotti import conf_defaults settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.populators'] = 'kotti.testing._populator' _resolve_dotted(settings) return settings
def unresolved_settings(custom_settings): from kotti import conf_defaults from kotti.testing import testing_db_url settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.populators'] = 'kotti.testing._populator' settings['sqlalchemy.url'] = testing_db_url() settings.update(custom_settings) return settings
def settings(): from kotti import _resolve_dotted from kotti import conf_defaults settings = conf_defaults.copy() settings["kotti.secret"] = "secret" settings["kotti.secret2"] = "secret2" settings["kotti.populators"] = "kotti.testing._populator" _resolve_dotted(settings) return settings
def settings(): from kotti import _resolve_dotted from kotti import conf_defaults settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.configurators'] = \ 'kotti_navigation.kotti_configure kotti_settings.kotti_configure' settings['kotti.populators'] = 'kotti.testing._populator' _resolve_dotted(settings) return settings
def unresolved_settings(custom_settings): from kotti import conf_defaults from kotti.testing import testing_db_url settings = conf_defaults.copy() settings["kotti.secret"] = "secret" settings["kotti.secret2"] = "secret2" settings["kotti.populators"] = "kotti.testing._populator" settings["sqlalchemy.url"] = testing_db_url() settings.update(custom_settings) return settings
def settings(): from kotti import _resolve_dotted from kotti import conf_defaults settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.configurators'] += \ ' kotti_settings.kotti_configure kotti_navigation.kotti_configure' settings['kotti.populators'] += ' kotti_navigation.populate.populate kotti_navigation.tests._populate_left' settings['pyramid.includes'] += ' kotti_settings kotti_settings.views' settings = _resolve_dotted(settings) return settings
def settings(): from kotti import _resolve_dotted from kotti import conf_defaults from kotti_calendar import kotti_configure settings = conf_defaults.copy() settings.update({ 'pyramid.includes': 'kotti_calendar.widgets.includeme_upcoming_events'}) kotti_configure(settings) settings.update({ 'kotti.secret': 'secret', 'kotti.secret2': 'secret', }) _resolve_dotted(settings) return settings
def setUp(**kwargs): tearDown() settings = kwargs.get('settings', {}) if not settings: settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' _resolve_dotted(settings) kwargs['settings'] = settings config = testing.setUp(**kwargs) _initTestingDB() for name, renderer in DEFAULT_RENDERERS: config.add_renderer(name, renderer) transaction.begin() return config
def setUp(init_db=True, **kwargs): # _turn_warnings_into_errors() from kotti import _resolve_dotted from kotti import conf_defaults tearDown() settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.populators'] = 'kotti.testing._populator' settings.update(kwargs.get('settings', {})) settings = _resolve_dotted(settings) kwargs['settings'] = settings config = testing.setUp(**kwargs) config.add_default_renderers() if init_db: _initTestingDB() transaction.begin() return config
def setUp(init_db=True, **kwargs): # _turn_warnings_into_errors() from kotti import _resolve_dotted from kotti import conf_defaults tearDown() settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.populators'] = 'kotti.testing._populator' settings.update(kwargs.get('settings', {})) _resolve_dotted(settings) kwargs['settings'] = settings config = testing.setUp(**kwargs) config.add_default_renderers() if init_db: _initTestingDB() transaction.begin() return config
def setUp(init_db=True, **kwargs): from kotti import _resolve_dotted from kotti import conf_defaults # import warnings; warnings.filterwarnings("error") tearDown() settings = conf_defaults.copy() settings['kotti.secret'] = 'secret' settings['kotti.secret2'] = 'secret2' settings['kotti.populators'] = 'kotti.testing._populator' settings.update(kwargs.get('settings', {})) _resolve_dotted(settings) kwargs['settings'] = settings config = testing.setUp(**kwargs) for name, renderer in DEFAULT_RENDERERS: config.add_renderer(name, renderer) if init_db: _initTestingDB() transaction.begin() return config
def setUp(init_db=True, **kwargs): # _turn_warnings_into_errors() from kotti import _resolve_dotted from kotti import conf_defaults tearDown() settings = conf_defaults.copy() settings["kotti.secret"] = "secret" settings["kotti.secret2"] = "secret2" settings["kotti.populators"] = "kotti.testing._populator" settings["pyramid_deform.tempdir"] = "/tmp" settings.update(kwargs.get("settings", {})) settings = _resolve_dotted(settings) kwargs["settings"] = settings config = testing.setUp(**kwargs) config.add_default_renderers() if init_db: _init_testing_db() transaction.begin() return config
def kotti_migrate_command(): __doc__ = """Migrate Kotti and Kotti add-ons. Usage: kotti-migrate <config_uri> list_all kotti-migrate <config_uri> upgrade [--scripts=<location>] [--rev=<rev>] kotti-migrate <config_uri> upgrade_all kotti-migrate <config_uri> stamp_head [--scripts=<location>] [--rev=<rev>] o 'list_all' prints a list of all available migrations of Kotti and registered add-ons. o 'upgrade' will run Kotti's upgrades to upgrade the database to the latest version. Use '--scripts=kotti_myaddon:alembic' to run the upgrades of the 'kotti_myaddon' package instead. o 'upgrade_all' will run all upgrades of all packages registered with Kotti. o 'stamp_head' allows you to manually set the stamped version to the latest version inside the 'kotti_alembic_version' table, that is, without actually running any migrations. You may use this command for a different package by using the '--scripts' option. Options: -h --help Show this screen. """ # We need to turn off populators and root_factory when we run # migrations, because they would access the database, which may # not be possible prior to the migration. # # Unfortunately, we're not able to just set the 'kotti.populators' # setting to an empty list. Since add-ons might add to this list # again later, when we call 'bootstrap' (and thus their # 'includeme' function). save_conf_defaults = conf_defaults.copy() os.environ['KOTTI_DISABLE_POPULATORS'] = '1' conf_defaults['kotti.root_factory'] = [lambda req: None] def callback(arguments): args = () args_with_location = (arguments['--scripts'] or DEFAULT_LOCATION,) if arguments['list_all']: func = list_all elif arguments['upgrade']: func = upgrade args = args_with_location + (arguments['--rev'],) elif arguments['upgrade_all']: func = upgrade_all elif arguments['stamp_head']: func = stamp_head args = args_with_location + (arguments['--rev'],) func(*args) try: return command(callback, __doc__) finally: conf_defaults.clear() conf_defaults.update(save_conf_defaults) del os.environ['KOTTI_DISABLE_POPULATORS']
def kotti_migrate_command(): __doc__ = """Migrate Kotti and Kotti add-ons. Usage: kotti-migrate <config_uri> list_all kotti-migrate <config_uri> upgrade [--scripts=<location>] [--rev=<rev>] kotti-migrate <config_uri> upgrade_all kotti-migrate <config_uri> stamp_head [--scripts=<location>] [--rev=<rev>] o 'list_all' prints a list of all available migrations of Kotti and registered add-ons. o 'upgrade' will run Kotti's upgrades to upgrade the database to the latest version. Use '--scripts=kotti_myaddon:alembic' to run the upgrades of the 'kotti_myaddon' package instead. o 'upgrade_all' will run all upgrades of all packages registered with Kotti. o 'stamp_head' allows you to manually set the stamped version to the latest version inside the 'kotti_alembic_version' table, that is, without actually running any migrations. You may use this command for a different package by using the '--scripts' option. Options: -h --help Show this screen. """ # We need to turn off populators and root_factory when we run # migrations, because they would access the database, which may # not be possible prior to the migration. # # Unfortunately, we're not able to just set the 'kotti.populators' # setting to an empty list. Since add-ons might add to this list # again later, when we call 'bootstrap' (and thus their # 'includeme' function). save_conf_defaults = conf_defaults.copy() os.environ["KOTTI_DISABLE_POPULATORS"] = "1" conf_defaults["kotti.root_factory"] = [lambda req: None] def callback(arguments): args = () args_with_location = (arguments["--scripts"] or DEFAULT_LOCATION,) if arguments["list_all"]: func = list_all elif arguments["upgrade"]: func = upgrade args = args_with_location + (arguments["--rev"],) elif arguments["upgrade_all"]: func = upgrade_all elif arguments["stamp_head"]: func = stamp_head args = args_with_location + (arguments["--rev"],) else: raise ValueError("Unknown command") func(*args) try: return command(callback, __doc__) finally: conf_defaults.clear() conf_defaults.update(save_conf_defaults) del os.environ["KOTTI_DISABLE_POPULATORS"]