diff --git a/rattail/importing/exporters.py b/rattail/importing/exporters.py index a613c0069510b57e092dfa632ae3bc407e109187..0c3ea0541211f02b5ab0c7bd214e1f3433ebfac0 100644 --- a/rattail/importing/exporters.py +++ b/rattail/importing/exporters.py @@ -164,11 +164,16 @@ class ToCSV(ToFile): """ Base class for importers which target CSV file on the local side. """ + allow_delete = False empty_local_data = True def open_output_file(self): - self.output_file = open(self.output_file_path, 'wt', encoding='utf_8') - self.output_writer = csv.DictWriter(self.output_file, self.fields) + self.output_file = open(self.output_file_path, 'wt', + encoding='utf_8') + + self.output_writer = csv.DictWriter(self.output_file, self.fields, + quoting=csv.QUOTE_NONNUMERIC) + self.write_output_header() def write_output_header(self): @@ -197,6 +202,9 @@ class ToCSV(ToFile): if value is None: value = '' + elif isinstance(value, (int, float)): + pass + else: value = str(value) diff --git a/rattail/importing/rattail.py b/rattail/importing/rattail.py index 140bc87f1f2c5244cf0484e5b23be2ae52b0c9ad..9994299c0b438f67d4cd9d6e72a1beff559a2d96 100644 --- a/rattail/importing/rattail.py +++ b/rattail/importing/rattail.py @@ -43,6 +43,7 @@ class FromRattailHandler(FromSQLAlchemyHandler): Base class for import handlers which target a Rattail database on the local side. """ host_key = 'rattail' + host_title = "Rattail" generic_host_title = "Rattail" @property diff --git a/rattail/products.py b/rattail/products.py index 389665cc9ea0bd1bacd48c2ac8406ed3e81516f3..3702c5e68869682ae20dd51aef871ee5e3b47d17 100644 --- a/rattail/products.py +++ b/rattail/products.py @@ -766,6 +766,12 @@ class ProductsHandler(GenericHandler, MergeMixin): if upc: return pod.get_image_url(self.config, upc) + def get_last_sold(self, product, store=None, **kwargs): + """ + Fetch the "last sold" date for the given product (and store). + """ + raise NotImplementedError + def render_product_key(self, product, **kwargs): """ Render the key value for the given product, as human-readable