Changeset f34703e in rattail
- Timestamp:
- 07/22/2022 12:38:16 PM (7 months ago)
- Branches:
- master
- Children:
- 032dcc3
- Parents:
- dfadd3f
- Location:
- rattail
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
rattail/datasync/daemon.py
rdfadd3f rf34703e 653 653 return False 654 654 655 else: # more attempts to be made, but log error for debug 656 log.debug("attempt #%s failed calling `consumer.process_changes()`", 657 attempts, exc_info=True) 658 655 659 # if this exception is not the first, and is of a different type 656 660 # than seen previously, do *not* continue to retry -
rattail/importing/model.py
rdfadd3f rf34703e 1716 1716 def set_config_flags(self): 1717 1717 1718 # set to True in order to auto-create record for "unknown" brand 1719 self.auto_create_unknown_brand = self.config.getbool( 1720 'rattail.importing', 'products.auto_create_unknown_brand', 1721 default=False) 1722 1718 1723 # set to True in order to auto-create record for "unknown" category 1719 1724 self.auto_create_unknown_category = self.config.getbool( … … 1725 1730 'rattail.importing', 'products.auto_create_unknown_report_code', 1726 1731 default=False) 1732 1733 # set to False in order to log debug instead of warning for "unknown" brand 1734 self.warn_for_unknown_brand = self.config.getbool( 1735 'rattail.importing', 'products.warn_for_unknown_brand', 1736 default=True) 1727 1737 1728 1738 # set to False in order to log debug instead of warning for "unknown" category … … 1967 1977 def update_object(self, product, data, local_data=None): 1968 1978 product = super(ProductImporter, self).update_object(product, data, local_data) 1979 model = self.model 1969 1980 1970 1981 if 'brand_name' in self.fields: … … 1972 1983 if name: 1973 1984 brand = self.get_brand(name) 1974 if not brand: 1985 if brand: 1986 product.brand = brand 1987 elif self.auto_create_unknown_brand: 1975 1988 brand = model.Brand() 1976 1989 brand.name = name 1977 1990 self.session.add(brand) 1978 1991 if hasattr(self, 'brands'): 1979 self.brands[brand.name] = brand 1980 product.brand = brand 1992 self.brands[name] = brand 1993 product.brand = brand 1994 else: 1995 logger = log.warning if self.warn_for_unknown_brand else log.debug 1996 logger("unknown brand for product %s: %s", product.uuid, name) 1997 if product.brand: 1998 product.brand = None 1981 1999 elif product.brand: 1982 2000 product.brand = None
Note: See TracChangeset
for help on using the changeset viewer.