mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-18 16:41:18 +02:00
2021-12-12 Fred Gleason <fredg@paravelsystems.com>
* Added a 'Service()' type class to the 'rivwebpyapi' API. * Modified the 'rivwebpyapi.ListServices()' call to return a list of 'rivwebpyapi.Service' objects. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -238,6 +238,11 @@ SCHEDULER_CODE_FIELDS={
|
||||
'description': 'string'
|
||||
}
|
||||
|
||||
SERVICE_FIELDS={
|
||||
'name': 'string',
|
||||
'description': 'string'
|
||||
}
|
||||
|
||||
class RivWebPyApi_ListHandler(ContentHandler):
|
||||
def __init__(self,base_tag,fields):
|
||||
self.__output=[]
|
||||
@@ -441,6 +446,10 @@ class SchedulerCode(RivendellType):
|
||||
def __init__(self,values={}):
|
||||
super().__init__(SCHEDULER_CODE_FIELDS,values)
|
||||
|
||||
class Service(RivendellType):
|
||||
def __init__(self,values={}):
|
||||
super().__init__(SERVICE_FIELDS,values)
|
||||
|
||||
class rivwebpyapi(object):
|
||||
"""
|
||||
Create a 'RivWebPyApi' object for accessing the Web API.
|
||||
@@ -1641,7 +1650,8 @@ class rivwebpyapi(object):
|
||||
|
||||
def ListServices(self,trackable):
|
||||
"""
|
||||
Returns a set of Rivendell services (list of dictionaries).
|
||||
Returns a set of Rivendell services
|
||||
(list of rivwebpyapi.Service objects).
|
||||
|
||||
Takes one argument:
|
||||
|
||||
@@ -1674,14 +1684,15 @@ class rivwebpyapi(object):
|
||||
#
|
||||
# Generate the output dictionary
|
||||
#
|
||||
fields={
|
||||
'name': 'string',
|
||||
'description': 'string'
|
||||
}
|
||||
handler=RivWebPyApi_ListHandler(base_tag='service',fields=fields)
|
||||
handler=RivWebPyApi_ListHandler(base_tag='service',
|
||||
fields=SERVICE_FIELDS)
|
||||
xml.sax.parseString(r.text,handler)
|
||||
out=handler.output()
|
||||
ret=[]
|
||||
for item in out:
|
||||
ret.append(Service(item))
|
||||
|
||||
return handler.output()
|
||||
return ret
|
||||
|
||||
def ListSystemSettings(self):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user