Changeset 8361148b in rattail


Ignore:
Timestamp:
07/27/2022 02:02:53 PM (6 months ago)
Author:
Lance Edgar <lance@…>
Branches:
master
Children:
6edc9b1
Parents:
5e978e8
Message:

Avoid more sessions in datasync, when fetching config from DB

ugh, there are probably even more somewhere..?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • rattail/importing/model.py

    r5e978e8 r8361148b  
    961961        self.auto_create_unknown_group = self.config.getbool(
    962962            'rattail.importing', 'customers.auto_create_unknown_group',
    963             default=False)
     963            default=False,
     964            session=self.session)
    964965
    965966        # set to False to log debug instead of warning for "unknown" customer group
    966967        self.warn_for_unknown_group = self.config.getbool(
    967968            'rattail.importing', 'customers.warn_for_unknown_group',
    968             default=True)
     969            default=True,
     970            session=self.session)
    969971
    970972    def cache_query_options(self):
     
    17191721        self.auto_create_unknown_brand = self.config.getbool(
    17201722            'rattail.importing', 'products.auto_create_unknown_brand',
    1721             default=True)
     1723            default=True,
     1724            session=self.session)
    17221725
    17231726        # set to True in order to auto-create record for "unknown" category
    17241727        self.auto_create_unknown_category = self.config.getbool(
    17251728            'rattail.importing', 'products.auto_create_unknown_category',
    1726             default=False)
     1729            default=False,
     1730            session=self.session)
    17271731
    17281732        # set to True in order to auto-create record for "unknown" report code
    17291733        self.auto_create_unknown_report_code = self.config.getbool(
    17301734            'rattail.importing', 'products.auto_create_unknown_report_code',
    1731             default=False)
     1735            default=False,
     1736            session=self.session)
    17321737
    17331738        # set to True in order to log warning instead of debug for "unknown" brand
    17341739        self.warn_for_unknown_brand = self.config.getbool(
    17351740            'rattail.importing', 'products.warn_for_unknown_brand',
    1736             default=False)
     1741            default=False,
     1742            session=self.session)
    17371743
    17381744        # set to False in order to log debug instead of warning for "unknown" category
    17391745        self.warn_for_unknown_category = self.config.getbool(
    17401746            'rattail.importing', 'products.warn_for_unknown_category',
    1741             default=True)
     1747            default=True,
     1748            session=self.session)
    17421749
    17431750        # set to False in order to log debug instead of warning for "unknown" report code
    17441751        self.warn_for_unknown_report_code = self.config.getbool(
    17451752            'rattail.importing', 'products.warn_for_unknown_report_code',
    1746             default=True)
     1753            default=True,
     1754            session=self.session)
    17471755
    17481756    def cache_query(self):
     
    27862794        query = super(LabelProfileImporter, self).cache_query()
    27872795
    2788         if not self.config.getbool('rattail', 'labels.sync_all_profiles', default=False):
     2796        sync_all = self.config.getbool('rattail', 'labels.sync_all_profiles',
     2797                                       default=False,
     2798                                       session=self.session)
     2799        if not sync_all:
    27892800            # only fetch labels from host which are marked as "sync me"
    27902801            query = query .filter(self.model_class.sync_me == True)
Note: See TracChangeset for help on using the changeset viewer.