Compare commits

...

3 commits

Author SHA1 Message Date
Lance Edgar 7249598b35 bump: version 0.3.1 → 0.3.2 2024-11-18 19:17:09 -06:00
Lance Edgar 3514b47776 fix: add startup workaround for CORE model imports, to avoid error
still not 100% clear why this has started happening but clearly has
something to do with changes to wuttjamaican / rattail config startup
sequence..
2024-11-18 19:15:51 -06:00
Lance Edgar 494cae2433 docs: update project links, kallithea -> forgejo 2024-09-14 13:39:25 -05:00
3 changed files with 44 additions and 6 deletions

View file

@ -5,6 +5,12 @@ All notable changes to tailbone-corepos will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## v0.3.2 (2024-11-18)
### Fix
- add startup workaround for CORE model imports, to avoid error
## v0.3.1 (2024-08-18)
### Fix

View file

@ -6,7 +6,7 @@ build-backend = "hatchling.build"
[project]
name = "tailbone-corepos"
version = "0.3.1"
version = "0.3.2"
description = "Tailbone interfaces for CORE POS"
readme = "README.md"
authors = [{name = "Lance Edgar", email = "lance@edbob.org"}]
@ -33,10 +33,10 @@ dependencies = [
[project.urls]
Homepage = "https://redmine.rattailproject.org/projects/corepos-integration"
Repository = "https://kallithea.rattailproject.org/rattail-project/tailbone-corepos"
Issues = "https://redmine.rattailproject.org/projects/corepos-integration/issues"
Changelog = "https://kallithea.rattailproject.org/rattail-project/tailbone-corepos/files/master/CHANGELOG.md"
Homepage = "https://rattailproject.org"
Repository = "https://forgejo.wuttaproject.org/rattail/tailbone-corepos"
Issues = "https://forgejo.wuttaproject.org/rattail/tailbone-corepos/issues"
Changelog = "https://forgejo.wuttaproject.org/rattail/tailbone-corepos/src/branch/master/CHANGELOG.md"
[project.entry-points."tailbone.providers"]

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2023 Lance Edgar
# Copyright © 2010-2024 Lance Edgar
#
# This file is part of Rattail.
#
@ -24,6 +24,7 @@
Tailbone Provider for CORE-POS Integration
"""
import sqlalchemy as sa
from sqlalchemy.orm import sessionmaker, scoped_session
from zope.sqlalchemy import register
@ -71,6 +72,37 @@ class TailboneCorePosProvider(TailboneProvider):
register(Session)
ExtraCoreTransArchiveSessions[key] = Session
# 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 rattail_config.core_office_op_engine:
app = rattail_config.get_app()
corepos = app.get_corepos_handler()
# nb. use fake db to avoid true cxn errors, since the only
# point of this is to load the models
engine = sa.create_engine('sqlite://')
# office_op
core_model = corepos.get_model_office_op()
core_session = corepos.make_session_office_op(bind=engine)
try:
core_session.query(core_model.Store).first()
except sa.exc.OperationalError:
pass
core_session.close()
# office_trans
core_model = corepos.get_model_office_trans()
core_session = corepos.make_session_office_trans(bind=engine)
try:
core_session.query(core_model.TransactionDetail).first()
except sa.exc.OperationalError:
pass
core_session.close()
def get_provided_views(self):
return {