2021-12-13 Fred Gleason <fredg@paravelsystems.com>

* Added a 'LogLock()' type class to the 'rivwebpyapi' API.
	* Modified the 'rivwebpyapi.LockLog()' call to return
	a  'rivwebpyapi.LogLock' object.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason 2021-12-13 16:29:05 -05:00
parent da9cb3eae3
commit d276d58aac
3 changed files with 21 additions and 11 deletions

View File

@ -22783,3 +22783,7 @@
* Added a 'SystemSettings()' type class to the 'rivwebpyapi' API.
* Modified the 'rivwebpyapi.ListSystemSettings()' call to return
a 'rivwebpyapi.SystemSettings' object.
2021-12-13 Fred Gleason <fredg@paravelsystems.com>
* Added a 'LogLock()' type class to the 'rivwebpyapi' API.
* Modified the 'rivwebpyapi.LockLog()' call to return
a 'rivwebpyapi.LogLock' object.

View File

@ -233,6 +233,14 @@ LOGLINE_FIELDS={
'extAnncType': 'string'
}
LOG_LOCK_FIELDS={
'result': 'boolean',
'logName': 'string',
'lockGuid': 'string',
'address': 'string',
'lockTimeout': 'integer'
}
SCHEDULER_CODE_FIELDS={
'code': 'string',
'description': 'string'
@ -455,6 +463,10 @@ class LogLine(RivendellType):
def __init__(self,values={}):
super().__init__(LOGLINE_FIELDS,values)
class LogLock(RivendellType):
def __init__(self,values={}):
super().__init__(LOG_LOCK_FIELDS,values)
class SchedulerCode(RivendellType):
def __init__(self,values={}):
super().__init__(SCHEDULER_CODE_FIELDS,values)
@ -1743,7 +1755,7 @@ class rivwebpyapi(object):
def LockLog(self,log_name,operation,guid):
"""
Manage the lock for the specified log (dictionary).
Manage the lock for the specified log (rivwebpyapi.LogLock object).
Takes the following argument:
@ -1795,7 +1807,7 @@ class rivwebpyapi(object):
handler=RivWebPyApi_ListHandler(base_tag='logLock',fields=fields)
xml.sax.parseString(r.text,handler)
return handler.output()[0]
return LogLock(handler.output()[0])
def PostImage(self,image_id):
"""

View File

@ -78,7 +78,7 @@ if((operation!='CREATE')and(not guid)):
#
webapi=rivwebpyapi.rivwebpyapi(url=url,username=username,password=password)
try:
result=webapi.LockLog(log_name=log_name,operation=operation,guid=guid)
lock=webapi.LockLog(log_name=log_name,operation=operation,guid=guid)
except rivwebpyapi.RivWebPyError as err:
eprint('*** ERROR ***')
eprint('Response Code: '+str(err.responseCode))
@ -90,12 +90,6 @@ except rivwebpyapi.RivWebPyError as err:
#
# Display the result
#
for key in lock.values():
print(key+': '+str(lock.values()[key]))
print('')
print('RESULT:')
print('result: '+str(result['result']))
print('logName: '+str(result['logName']))
print('lockGuid: '+str(result['lockGuid']))
print('address: '+str(result['address']))
print('lockTimeout: '+str(result['address']))
print('')