Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

137 get resp name examination func #525

Merged
merged 3 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions api/namex/services/nro/oracle_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,29 +152,36 @@ def set_request_status_to_h(self, nr_num, examiner_username ):
:return: naked
:raise: (NROServicesError) with the error information set
"""

current_app.logger.debug(examiner_username)
try:
con = self.connection
con.begin() # explicit transaction in case we need to do other things than just call the stored proc
try:
cursor = con.cursor()

# set the fqpn if the schema is required, which is set y the deployer/configurator
# if the environment variable is missing from the Flask Config, then skip setting it.
if current_app.config.get('NRO_SCHEMA'):
proc_name = '{}.nro_datapump_pkg.name_examination'.format(current_app.config.get('NRO_SCHEMA'))
func_name = '{}.nro_datapump_pkg.name_examination_func'.format(current_app.config.get('NRO_SCHEMA'))
else:
proc_name = 'nro_datapump_pkg.name_examination'
func_name = 'nro_datapump_pkg.name_examination_func'

proc_vars = [nr_num, # p_nr_number
func_vars = [nr_num, # p_nr_number
'H', # p_status
'', # p_expiry_date - mandatory, but ignored by the proc
'', # p_consent_flag- mandatory, but ignored by the proc
nro_examiner_name(examiner_username), # p_examiner_id
]

# We don't call procedure anymore as it didn't return value. In other words,
# we don't know if the data was processed successfully or not by store procedure.
# Call the name_examination procedure to save complete decision data for a single NR
cursor.callproc(proc_name, proc_vars)
#cursor.callproc(proc_name, proc_vars)

# Call the function to save complete decision data for a single NR
# and get a return if all data was saved
ret = cursor.callfunc(func_name, str, func_vars)
if ret is not None:
current_app.logger.error('name_examination_func failed, return message: {}'.format(ret))
raise NROServicesError({"code": "unable_to_set_state", "description": ret}, 500)

con.commit()

Expand All @@ -183,8 +190,8 @@ def set_request_status_to_h(self, nr_num, examiner_username ):
current_app.logger.error("NR#:", nr_num, "Oracle-Error-Code:", error.code)
if con:
con.rollback()
raise NROServicesError({"code": "unable_to_set_state",
"description": "Unable to set the state of the NR in NRO"}, 500)
raise NROServicesError({"code": "unable_to_set_state",
"description": "Unable to set the state of the NR in NRO"}, 500)
except Exception as err:
current_app.logger.error("NR#:", nr_num, err.with_traceback(None))
if con:
Expand Down
1 change: 0 additions & 1 deletion api/tests/python/nro_services/test_nro_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def test_get_last_modified_timestamp(app):

@integration_oracle_namesdb
def test_set_status_2_h(app):

nro.set_request_status_to_h('NR 5970035', 'anyname')


Expand Down
Loading