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 'Group()' type class to the 'rivwebpyapi' API. * Modified the 'rivwebpyapi.ListGroup()' call to return a 'rivwebpyapi.Group' object. * Modified the 'rivwebpyapi.ListGroups()' call to return a list of 'rivwebpyapi.Group' objects. Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
@@ -121,6 +121,20 @@ CUT_FIELDS={
|
||||
'talkEndPoint': 'integer'
|
||||
}
|
||||
|
||||
GROUP_FIELDS={
|
||||
'name': 'string',
|
||||
'description': 'string',
|
||||
'defaultCartType': 'string',
|
||||
'defaultLowCart': 'integer',
|
||||
'defaultHighCart': 'integer',
|
||||
'cutShelfLife': 'integer',
|
||||
'defaultTitle': 'string',
|
||||
'enforceCartRange': 'boolean',
|
||||
'reportTfc': 'boolean',
|
||||
'reportMus': 'boolean',
|
||||
'color': 'string'
|
||||
}
|
||||
|
||||
LOG_FIELDS={
|
||||
'name': 'string',
|
||||
'serviceName': 'string',
|
||||
@@ -411,6 +425,10 @@ class Cut(RivendellType):
|
||||
def __init__(self,values={}):
|
||||
super().__init__(CUT_FIELDS,values)
|
||||
|
||||
class Group(RivendellType):
|
||||
def __init__(self,values={}):
|
||||
super().__init__(GROUP_FIELDS,values)
|
||||
|
||||
class Log(RivendellType):
|
||||
def __init__(self,values={}):
|
||||
super().__init__(LOG_FIELDS,values)
|
||||
@@ -1417,7 +1435,7 @@ class rivwebpyapi(object):
|
||||
|
||||
def ListGroup(self,group_name):
|
||||
"""
|
||||
Returns a Rivendell group (dictionary).
|
||||
Returns a Rivendell group (rivwebpyapi.Group object).
|
||||
|
||||
Takes the following argument:
|
||||
|
||||
@@ -1445,27 +1463,15 @@ class rivwebpyapi(object):
|
||||
#
|
||||
# Generate the output dictionary
|
||||
#
|
||||
fields={
|
||||
'name': 'string',
|
||||
'description': 'string',
|
||||
'defaultCartType': 'string',
|
||||
'defaultLowCart': 'integer',
|
||||
'defaultHighCart': 'integer',
|
||||
'cutShelfLife': 'integer',
|
||||
'defaultTitle': 'string',
|
||||
'enforceCartRange': 'boolean',
|
||||
'reportTfc': 'boolean',
|
||||
'reportMus': 'boolean',
|
||||
'color': 'string'
|
||||
}
|
||||
handler=RivWebPyApi_ListHandler(base_tag='group',fields=fields)
|
||||
handler=RivWebPyApi_ListHandler(base_tag='group',fields=GROUP_FIELDS)
|
||||
xml.sax.parseString(r.text,handler)
|
||||
|
||||
return handler.output()[0]
|
||||
return Group(handler.output()[0])
|
||||
|
||||
def ListGroups(self):
|
||||
"""
|
||||
Returns a list of all Rivendell groups (list of dictionaries).
|
||||
Returns a list of all Rivendell groups
|
||||
(list of rivwebpyapi.Group objects).
|
||||
"""
|
||||
|
||||
#
|
||||
@@ -1487,23 +1493,14 @@ class rivwebpyapi(object):
|
||||
#
|
||||
# Generate the output dictionary
|
||||
#
|
||||
fields={
|
||||
'name': 'string',
|
||||
'description': 'string',
|
||||
'defaultCartType': 'string',
|
||||
'defaultLowCart': 'integer',
|
||||
'defaultHighCart': 'integer',
|
||||
'cutShelfLife': 'integer',
|
||||
'defaultTitle': 'string',
|
||||
'enforceCartRange': 'boolean',
|
||||
'reportTfc': 'boolean',
|
||||
'reportMus': 'boolean',
|
||||
'color': 'string'
|
||||
}
|
||||
handler=RivWebPyApi_ListHandler(base_tag='group',fields=fields)
|
||||
handler=RivWebPyApi_ListHandler(base_tag='group',fields=GROUP_FIELDS)
|
||||
xml.sax.parseString(r.text,handler)
|
||||
out=handler.output()
|
||||
ret=[]
|
||||
for item in out:
|
||||
ret.append(Group(item))
|
||||
|
||||
return handler.output()
|
||||
return ret
|
||||
|
||||
def ListLog(self,log_name):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user