Tweak how we handle return value from API 'set' method for Vendors

also add note about using `set_vendor()` for creating new ones.

and misc. other cleanup
This commit is contained in:
Lance Edgar 2020-03-04 18:54:34 -06:00
parent 73b0acecdd
commit a12c9de415
2 changed files with 9 additions and 11 deletions

View file

@ -156,6 +156,12 @@ class CoreWebAPI(object):
Update an existing Vendor record in CORE. Update an existing Vendor record in CORE.
:returns: Boolean indicating success of the operation. :returns: Boolean indicating success of the operation.
.. note::
Currently this is being used to create a *new* vendor also. CORE's
``vendors`` table does not use auto-increment for its PK, which
means we must provide one even when creating; therefore this method
may be used for that.
""" """
columns['vendorID'] = vendorID columns['vendorID'] = vendorID
params = { params = {
@ -165,10 +171,4 @@ class CoreWebAPI(object):
} }
response = self.post(params) response = self.post(params)
result = self.parse_response(response) result = self.parse_response(response)
return json.loads(result)
if result == 'OK':
return True
# TODO: need to see what happens here, when it happens
raise NotImplementedError("Unexpected result for set_vendor: {}".format(result))
# return False

View file

@ -2,7 +2,7 @@
################################################################################ ################################################################################
# #
# pyCOREPOS -- Python Interface to CORE POS # pyCOREPOS -- Python Interface to CORE POS
# Copyright © 2018-2019 Lance Edgar # Copyright © 2018-2020 Lance Edgar
# #
# This file is part of pyCOREPOS. # This file is part of pyCOREPOS.
# #
@ -24,11 +24,9 @@
CORE POS Database Utilities CORE POS Database Utilities
""" """
from __future__ import unicode_literals, absolute_import
import sqlalchemy as sa import sqlalchemy as sa
from corepos.db import model as corepos from corepos.db.office_op import model as corepos
def get_last_card_number(session): def get_last_card_number(session):