mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-05-22 15:41:41 +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:
parent
b9164bad15
commit
0443fd9341
@ -22769,3 +22769,9 @@
|
||||
a list of 'rivwebpyapi.SchedulerCode' objects.
|
||||
* Modified the 'rivwebpyapi.ListSchedulerCodes()' call to return
|
||||
a list of 'rivwebpyapi.SchedulerCode' objects.
|
||||
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.
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -71,17 +71,8 @@ except rivwebpyapi.RivWebPyError as err:
|
||||
sys.exit(1)
|
||||
|
||||
#
|
||||
# Display the group list
|
||||
# Display the group
|
||||
#
|
||||
print('')
|
||||
print('name: '+grp['name'])
|
||||
print('description: '+grp['description'])
|
||||
print('defaultCartType: '+grp['defaultCartType'])
|
||||
print('defaultLowCart: '+str(grp['defaultLowCart']))
|
||||
print('defaultHighCart: '+str(grp['defaultHighCart']))
|
||||
print('cutShelfLife: '+str(grp['cutShelfLife']))
|
||||
print('defaultTitle: '+grp['defaultTitle'])
|
||||
print('enforceCartRange: '+str(grp['enforceCartRange']))
|
||||
print('reportTfc: '+str(grp['reportTfc']))
|
||||
print('reportMus: '+str(grp['reportMus']))
|
||||
for key in grp.values():
|
||||
print(key+': '+str(grp.values()[key]))
|
||||
print('')
|
||||
|
@ -69,14 +69,6 @@ except rivwebpyapi.RivWebPyError as err:
|
||||
# Display the group list
|
||||
#
|
||||
for grp in groups:
|
||||
print('name: '+grp['name'])
|
||||
print('description: '+grp['description'])
|
||||
print('defaultCartType: '+grp['defaultCartType'])
|
||||
print('defaultLowCart: '+str(grp['defaultLowCart']))
|
||||
print('defaultHighCart: '+str(grp['defaultHighCart']))
|
||||
print('cutShelfLife: '+str(grp['cutShelfLife']))
|
||||
print('defaultTitle: '+grp['defaultTitle'])
|
||||
print('enforceCartRange: '+str(grp['enforceCartRange']))
|
||||
print('reportTfc: '+str(grp['reportTfc']))
|
||||
print('reportMus: '+str(grp['reportMus']))
|
||||
for key in grp.values():
|
||||
print(key+': '+str(grp.values()[key]))
|
||||
print('')
|
||||
|
Loading…
x
Reference in New Issue
Block a user