mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-06-03 17:42:32 +02:00
2021-12-12 Fred Gleason <fredg@paravelsystems.com>
* Added a 'SystemSettings()' type class to the 'rivwebpyapi' API. * Modified the 'rivwebpyapi.ListSystemSettings()' call to return a 'rivwebpyapi.SystemSettings' object. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
parent
6b923ffbda
commit
da9cb3eae3
@ -22779,3 +22779,7 @@
|
|||||||
* Added a 'Service()' type class to the 'rivwebpyapi' API.
|
* Added a 'Service()' type class to the 'rivwebpyapi' API.
|
||||||
* Modified the 'rivwebpyapi.ListServices()' call to return
|
* Modified the 'rivwebpyapi.ListServices()' call to return
|
||||||
a list of 'rivwebpyapi.Service' objects.
|
a list of 'rivwebpyapi.Service' objects.
|
||||||
|
2021-12-12 Fred Gleason <fredg@paravelsystems.com>
|
||||||
|
* Added a 'SystemSettings()' type class to the 'rivwebpyapi' API.
|
||||||
|
* Modified the 'rivwebpyapi.ListSystemSettings()' call to return
|
||||||
|
a 'rivwebpyapi.SystemSettings' object.
|
||||||
|
@ -243,6 +243,19 @@ SERVICE_FIELDS={
|
|||||||
'description': 'string'
|
'description': 'string'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SYSTEM_SETTINGS_FIELDS={
|
||||||
|
'realmName': 'string',
|
||||||
|
'sampleRate': 'integer',
|
||||||
|
'duplicateTitles': 'boolean',
|
||||||
|
'fixDuplicateTitles': 'boolean',
|
||||||
|
'maxPostLength': 'integer',
|
||||||
|
'isciXreferencePath': 'string',
|
||||||
|
'tempCartGroup': 'string',
|
||||||
|
'longDateFormat': 'string',
|
||||||
|
'shortDateFormat': 'string',
|
||||||
|
'showTwelveHourTime': 'boolean'
|
||||||
|
}
|
||||||
|
|
||||||
class RivWebPyApi_ListHandler(ContentHandler):
|
class RivWebPyApi_ListHandler(ContentHandler):
|
||||||
def __init__(self,base_tag,fields):
|
def __init__(self,base_tag,fields):
|
||||||
self.__output=[]
|
self.__output=[]
|
||||||
@ -450,6 +463,10 @@ class Service(RivendellType):
|
|||||||
def __init__(self,values={}):
|
def __init__(self,values={}):
|
||||||
super().__init__(SERVICE_FIELDS,values)
|
super().__init__(SERVICE_FIELDS,values)
|
||||||
|
|
||||||
|
class SystemSettings(RivendellType):
|
||||||
|
def __init__(self,values={}):
|
||||||
|
super().__init__(SYSTEM_SETTINGS_FIELDS,values)
|
||||||
|
|
||||||
class rivwebpyapi(object):
|
class rivwebpyapi(object):
|
||||||
"""
|
"""
|
||||||
Create a 'RivWebPyApi' object for accessing the Web API.
|
Create a 'RivWebPyApi' object for accessing the Web API.
|
||||||
@ -1696,7 +1713,7 @@ class rivwebpyapi(object):
|
|||||||
|
|
||||||
def ListSystemSettings(self):
|
def ListSystemSettings(self):
|
||||||
"""
|
"""
|
||||||
Returns Rivendell system settings (dictionary).
|
Returns Rivendell system settings (rivwebpyapi.SystemSettings object).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -1718,22 +1735,11 @@ class rivwebpyapi(object):
|
|||||||
#
|
#
|
||||||
# Generate the output dictionary
|
# Generate the output dictionary
|
||||||
#
|
#
|
||||||
fields={
|
handler=RivWebPyApi_ListHandler(base_tag='systemSettings',
|
||||||
'realmName': 'string',
|
fields=SYSTEM_SETTINGS_FIELDS)
|
||||||
'sampleRate': 'integer',
|
|
||||||
'duplicateTitles': 'boolean',
|
|
||||||
'fixDuplicateTitles': 'boolean',
|
|
||||||
'maxPostLength': 'integer',
|
|
||||||
'isciXreferencePath': 'string',
|
|
||||||
'tempCartGroup': 'string',
|
|
||||||
'longDateFormat': 'string',
|
|
||||||
'shortDateFormat': 'string',
|
|
||||||
'showTwelveHourTime': 'boolean'
|
|
||||||
}
|
|
||||||
handler=RivWebPyApi_ListHandler(base_tag='systemSettings',fields=fields)
|
|
||||||
xml.sax.parseString(r.text,handler)
|
xml.sax.parseString(r.text,handler)
|
||||||
|
|
||||||
return handler.output()[0]
|
return SystemSettings(handler.output()[0])
|
||||||
|
|
||||||
def LockLog(self,log_name,operation,guid):
|
def LockLog(self,log_name,operation,guid):
|
||||||
"""
|
"""
|
||||||
|
@ -59,7 +59,7 @@ if((not url)or(not username)):
|
|||||||
#
|
#
|
||||||
webapi=rivwebpyapi.rivwebpyapi(url=url,username=username,password=password)
|
webapi=rivwebpyapi.rivwebpyapi(url=url,username=username,password=password)
|
||||||
try:
|
try:
|
||||||
setting=webapi.ListSystemSettings()
|
settings=webapi.ListSystemSettings()
|
||||||
except rivwebpyapi.RivWebPyError as err:
|
except rivwebpyapi.RivWebPyError as err:
|
||||||
eprint('*** ERROR ***')
|
eprint('*** ERROR ***')
|
||||||
eprint('Response Code: '+str(err.responseCode))
|
eprint('Response Code: '+str(err.responseCode))
|
||||||
@ -69,16 +69,8 @@ except rivwebpyapi.RivWebPyError as err:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Display the settings list
|
# Display the settings
|
||||||
#
|
#
|
||||||
print('realmName: '+str(setting['realmName']))
|
for key in settings.values():
|
||||||
print('sampleRate: '+str(setting['sampleRate']))
|
print(key+': '+str(settings.values()[key]))
|
||||||
print('duplicateTitles: '+str(setting['duplicateTitles']))
|
|
||||||
print('fixDuplicateTitles: '+str(setting['fixDuplicateTitles']))
|
|
||||||
print('maxPostLength: '+str(setting['maxPostLength']))
|
|
||||||
print('isciXreferencePath: '+str(setting['isciXreferencePath']))
|
|
||||||
print('tempCartGroup: '+str(setting['tempCartGroup']))
|
|
||||||
print('longDateFormat: '+str(setting['longDateFormat']))
|
|
||||||
print('shortDateFormat: '+str(setting['shortDateFormat']))
|
|
||||||
print('showTwelveHourTime: '+str(setting['showTwelveHourTime']))
|
|
||||||
print('')
|
print('')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user