Changeset 8a0d62f in rattail


Ignore:
Timestamp:
03/12/19 13:47:39 (7 months ago)
Author:
Lance Edgar <ledgar@…>
Branches:
master
Children:
6b616b0
Parents:
25684be
Message:

Omit deprecated kwarg for session.is_modified()

when checking for pending changes, to be recorded to stub table. apparently
this could have been done a long time ago but only recently did warnings bring
my attention to it

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • rattail/db/changes.py

    r25684be r8a0d62f  
    33#
    44#  Rattail -- Retail Software Framework
    5 #  Copyright © 2010-2018 Lance Edgar
     5#  Copyright © 2010-2019 Lance Edgar
    66#
    77#  This file is part of Rattail.
     
    2929import logging
    3030
     31from packaging.version import parse as parse_version
     32import sqlalchemy as sa
    3133from sqlalchemy.orm import object_mapper, RelationshipProperty
    3234from sqlalchemy.orm.interfaces import SessionExtension
     
    99101    )
    100102
     103    # once upon a time we supposedly needed to specify `passive=True` when
     104    # invoking `session.is_modified()` but that has apparently been deprecated
     105    # for some time now.  we likely should just require SA>=0.8 instead of
     106    # maintaining this logic?
     107    is_modified_kw = {}
     108    if parse_version(sa.__version__) < parse_version('0.8'):
     109        is_modified_kw['passive'] = True
     110
    101111    def __call__(self, session, flush_context, instances):
    102112        """
     
    117127                self.process_new_object(session, obj)
    118128        for obj in session.dirty:
    119             if not self.ignore_object(obj) and session.is_modified(obj, passive=True):
     129            if not self.ignore_object(obj) and session.is_modified(obj, **self.is_modified_kw):
    120130                # Orphaned objects which really are pending deletion show up in
    121131                # session.dirty instead of session.deleted, hence this check.
  • setup.py

    r25684be r8a0d62f  
    33#
    44#  Rattail -- Retail Software Framework
    5 #  Copyright © 2010-2018 Lance Edgar
     5#  Copyright © 2010-2019 Lance Edgar
    66#
    77#  This file is part of Rattail.
     
    6767    'lockfile',                         # 0.9.1
    6868    'openpyxl',                         # 2.5.0
     69    'packaging',                        # 19.0
    6970    'progress',                         # 1.3
    7071    'six',                              # 1.10.0
Note: See TracChangeset for help on using the changeset viewer.