Changeset - c2141c776b65
[Not reviewed]
0 1 0
Lance Edgar (lance) - 1 month ago 2024-09-08 19:40:34
lance@edbob.org
docs: update comment for startup versioning workaround

now that i know a *little* more about why it is needed
1 file changed with 5 insertions and 5 deletions:
0 comments (0 inline, 0 general)
rattail/config.py
Show inline comments
 
@@ -776,17 +776,17 @@ def make_config(
 
    if versioning is None:
 
        versioning = config.versioning_enabled()
 
    if versioning:
 
        from rattail.db.config import configure_versioning
 
        configure_versioning(config)
 

	
 
        # TODO: holy crap why is this needed?  without it, the first time
 
        # a trainwreck query happens, InvalidRequestError is raised.  but
 
        # this is clearly a trainwreck query, and yet no error if we do it
 
        # this early in the startup sequence?!  i have no idea what is
 
        # going on here but at least this "works" - fingers crossed..
 
        # must import all sqlalchemy models before things get rolling,
 
        # otherwise can have errors about continuum TransactionMeta
 
        # class not yet mapped, when relevant pages are first requested
 
        # cf. https://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/database/sqlalchemy.html#importing-all-sqlalchemy-models
 
        # hat tip to https://stackoverflow.com/a/59241485
 
        if getattr(config, 'trainwreck_engines', None):
 
            app = config.get_app()
 
            trainwreck = app.get_trainwreck_handler()
 
            try:
 
                trainwreck_model = trainwreck.get_model()
 
            except WuttaConfigurationError:
0 comments (0 inline, 0 general)