Changeset - 874cbc4462bd
[Not reviewed]
1 3 0
Lance Edgar - 6 years ago 2019-02-18 21:27:57
ledgar@techsupport.coop
Clean up Rattail <-> Rattail import/export handlers a bit
4 files changed with 19 insertions and 317 deletions:
0 comments (0 inline, 0 general)
rattail/importing/rattail.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
# -*- coding: utf-8; -*-
 
################################################################################
 
#
 
#  Rattail -- Retail Software Framework
 
#  Copyright © 2010-2017 Lance Edgar
 
#  Copyright © 2010-2019 Lance Edgar
 
#
 
#  This file is part of Rattail.
 
#
 
@@ -127,31 +127,34 @@ class FromRattailToRattailBase(object):
 

	
 
class FromRattailToRattailImport(FromRattailToRattailBase, FromRattailHandler, ToRattailHandler):
 
    """
 
    Handler for Rattail -> Rattail data import.
 
    Handler for Rattail (other) -> Rattail (local) data import.
 
    """
 
    local_title = "Rattail (local)"
 
    dbkey = 'host'
 

	
 
    @property
 
    def host_title(self):
 
        return "Rattail ({})".format(self.dbkey)
 
        return "{} ({})".format(self.config.app_title(default="Rattail"), self.dbkey)
 

	
 
    @property
 
    def local_title(self):
 
        return self.config.node_title()
 

	
 
    def make_host_session(self):
 
        return Session(bind=self.config.rattail_engines[self.dbkey])
 

	
 
# TODO: deprecate/remove this?
 
FromRattailToRattail = FromRattailToRattailImport
 

	
 

	
 
class FromRattailToRattailExport(FromRattailToRattailBase, FromRattailHandler, ToRattailHandler):
 
    """
 
    Handler for Rattail -> Rattail data import.
 
    Handler for Rattail (local) -> Rattail (other) data export.
 
    """
 
    host_title = "Rattail (default)"
 

	
 
    @property
 
    def host_title(self):
 
        return self.config.node_title()
 

	
 
    @property
 
    def local_title(self):
 
        return "Rattail ({})".format(self.dbkey)
 
        return "{} ({})".format(self.config.app_title(default="Rattail"), self.dbkey)
 

	
 
    def make_session(self):
 
        return Session(bind=self.config.rattail_engines[self.dbkey])
rattail/importing/rattail_bulk.py
Show inline comments
 
# -*- coding: utf-8 -*-
 
# -*- coding: utf-8; -*-
 
################################################################################
 
#
 
#  Rattail -- Retail Software Framework
 
#  Copyright © 2010-2017 Lance Edgar
 
#  Copyright © 2010-2019 Lance Edgar
 
#
 
#  This file is part of Rattail.
 
#
 
@@ -28,10 +28,10 @@ from __future__ import unicode_literals, absolute_import
 

	
 
from rattail import importing
 
from rattail.util import OrderedDict
 
from rattail.importing.rattail import FromRattailToRattail, FromRattail
 
from rattail.importing.rattail import FromRattailToRattailImport, FromRattail
 

	
 

	
 
class BulkFromRattailToRattail(FromRattailToRattail, importing.BulkImportHandler):
 
class BulkFromRattailToRattail(FromRattailToRattailImport, importing.BulkImportHandler):
 
    """
 
    Handler for Rattail -> Rattail bulk data import.
 
    """
rattail/tests/commands/test_importing.py.bak
Show inline comments
 
deleted file
rattail/tests/importing/test_rattail.py
Show inline comments
 
@@ -56,7 +56,7 @@ class TestFromRattailHandler(RattailTestCase, ImporterTester):
 

	
 

	
 
class TestFromRattailToRattail(DualRattailTestCase, ImporterTester):
 
    handler_class = rattail_importing.FromRattailToRattail
 
    handler_class = rattail_importing.FromRattailToRattailImport
 

	
 
    def test_host_title(self):
 
        handler = self.make_handler()
0 comments (0 inline, 0 general)