Change dict iteritems to items for HTML templates

This commit is contained in:
JonnyWong16 2019-12-12 08:58:34 -08:00
parent 411d88d798
commit 70f7fd2de9
3 changed files with 9 additions and 9 deletions

View file

@ -43,14 +43,14 @@ DOCUMENTATION :: END
# Get audio codec file # Get audio codec file
def af(codec): def af(codec):
for pattern, file_type in MEDIA_FLAGS_AUDIO.iteritems(): for pattern, file_type in MEDIA_FLAGS_AUDIO.items():
if re.match(pattern, codec): if re.match(pattern, codec):
return file_type return file_type
return codec return codec
# Get audio codec file # Get audio codec file
def vf(codec): def vf(codec):
for pattern, file_type in MEDIA_FLAGS_VIDEO.iteritems(): for pattern, file_type in MEDIA_FLAGS_VIDEO.items():
if re.match(pattern, codec): if re.match(pattern, codec):
return file_type return file_type
return codec return codec

View file

@ -123,7 +123,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<select class="form-control" id="${item['name']}" name="${item['name']}"> <select class="form-control" id="${item['name']}" name="${item['name']}">
% for key, value in sorted(item['select_options'].iteritems()): % for key, value in sorted(item['select_options'].items()):
% if key == item['value']: % if key == item['value']:
<option value="${key}" selected>${value}</option> <option value="${key}" selected>${value}</option>
% else: % else:
@ -144,7 +144,7 @@
<option value="select-all">Select All</option> <option value="select-all">Select All</option>
<option value="remove-all">Remove All</option> <option value="remove-all">Remove All</option>
% if isinstance(item['select_options'], dict): % if isinstance(item['select_options'], dict):
% for section, options in item['select_options'].iteritems(): % for section, options in item['select_options'].items():
<optgroup label="${section}"> <optgroup label="${section}">
% for option in sorted(options, key=lambda x: x['text'].lower()): % for option in sorted(options, key=lambda x: x['text'].lower()):
<option value="${option['value']}">${option['text']}</option> <option value="${option['value']}">${option['text']}</option>
@ -325,7 +325,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<select class="form-control" id="${item['name']}" name="${item['name']}"> <select class="form-control" id="${item['name']}" name="${item['name']}">
% for key, value in sorted(item['select_options'].iteritems()): % for key, value in sorted(item['select_options'].items()):
% if key == item['value']: % if key == item['value']:
<option value="${key}" selected>${value}</option> <option value="${key}" selected>${value}</option>
% else: % else:
@ -346,7 +346,7 @@
<option value="select-all">Select All</option> <option value="select-all">Select All</option>
<option value="remove-all">Remove All</option> <option value="remove-all">Remove All</option>
% if isinstance(item['select_options'], dict): % if isinstance(item['select_options'], dict):
% for section, options in item['select_options'].iteritems(): % for section, options in item['select_options'].items():
<optgroup label="${section}"> <optgroup label="${section}">
% for option in sorted(options, key=lambda x: x['text'].lower()): % for option in sorted(options, key=lambda x: x['text'].lower()):
<option value="${option['value']}">${option['text']}</option> <option value="${option['value']}">${option['text']}</option>

View file

@ -88,7 +88,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<select class="form-control" id="${item['name']}" name="${item['name']}"> <select class="form-control" id="${item['name']}" name="${item['name']}">
% for key, value in sorted(item['select_options'].iteritems()): % for key, value in sorted(item['select_options'].items()):
% if key == item['value']: % if key == item['value']:
<option value="${key}" selected>${value}</option> <option value="${key}" selected>${value}</option>
% else: % else:
@ -109,7 +109,7 @@
<option value="select-all">Select All</option> <option value="select-all">Select All</option>
<option value="remove-all">Remove All</option> <option value="remove-all">Remove All</option>
% if isinstance(item['select_options'], dict): % if isinstance(item['select_options'], dict):
% for section, options in item['select_options'].iteritems(): % for section, options in item['select_options'].items():
<optgroup label="${section}"> <optgroup label="${section}">
% for option in sorted(options, key=lambda x: x['text'].lower()): % for option in sorted(options, key=lambda x: x['text'].lower()):
<option value="${option['value']}">${option['text']}</option> <option value="${option['value']}">${option['text']}</option>
@ -313,7 +313,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<select class="form-control" id="test_script" name="test_script"> <select class="form-control" id="test_script" name="test_script">
% for key, value in sorted(notifier['config_options'][2]['select_options'].iteritems()): % for key, value in sorted(notifier['config_options'][2]['select_options'].items()):
<option value="${key}">${value}</option> <option value="${key}">${value}</option>
% endfor % endfor
</select> </select>