Changeset - 485bf57183fe
[Not reviewed]
0 3 0
Lance Edgar (lance) - 17 months ago 2023-05-10 15:11:55
lance@edbob.org
Misc. tweaks for sake of Rattail -> Instacart export
3 files changed with 17 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rattail/importing/exporters.py
Show inline comments
 
@@ -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)
 

	
rattail/importing/rattail.py
Show inline comments
 
@@ -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
rattail/products.py
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)