diff --git a/machines/theo-server/deploy/theo-common/rattail.conf.mako b/machines/theo-server/deploy/theo-common/rattail.conf.mako index 6214c22..2b261be 100644 --- a/machines/theo-server/deploy/theo-common/rattail.conf.mako +++ b/machines/theo-server/deploy/theo-common/rattail.conf.mako @@ -8,6 +8,8 @@ [theo] + +## POS integration % if env.theo_integrates_with == 'corepos': integrate_corepos = true % elif env.theo_integrates_with == 'catapult': @@ -16,6 +18,9 @@ integrate_catapult = true integrate_locsms = true % endif +## POS DB mirror +mirror_posdb = ${'true' if env.theo_mirror_posdb else 'false'} + ## begin corepos % if env.theo_integrates_with == 'corepos': diff --git a/theo/config.py b/theo/config.py index 0e6d9dd..2ee3203 100644 --- a/theo/config.py +++ b/theo/config.py @@ -52,7 +52,10 @@ class TheoConfig(ConfigExtension): elif integrate_catapult(config): config.setdefault('rattail', 'model', 'theo.db.model_catapult') config.setdefault('rattail', 'settings', 'theo.appsettings.theo, theo.appsettings.catapult') - config.setdefault('rattail.mail', 'emails', 'theo.emails.theo, theo.emails.catapult') + emails = ['theo.emails.theo', 'theo.emails.catapult'] + if mirror_posdb(config): + emails.append('theo.emails.catapult_mirror') + config.setdefault('rattail.mail', 'emails', ', '.join(emails)) config.setdefault('rattail.importing', 'versions.handler', 'theo.importing.versions_catapult:FromTheoToTheoVersions') # do we integrate w/ LOC SMS? @@ -80,3 +83,8 @@ def integrate_corepos(config): def integrate_locsms(config): return config.getbool('theo', 'integrate_locsms', default=False, usedb=False) + + +def mirror_posdb(config): + return config.getbool('theo', 'mirror_posdb', default=False, + usedb=False) diff --git a/theo/emails/catapult_mirror.py b/theo/emails/catapult_mirror.py new file mode 100644 index 0000000..eaddcc0 --- /dev/null +++ b/theo/emails/catapult_mirror.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8; -*- +################################################################################ +# +# Rattail -- Retail Software Framework +# Copyright © 2010-2020 Lance Edgar +# +# This file is part of Rattail. +# +# Rattail 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. +# +# Rattail 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 +# Rattail. If not, see . +# +################################################################################ +""" +Theo email profile settings +""" + +from rattail_onager.emails import ( + rattail_onager_import_catapult_updates, +)