mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2025-01-07 19:05:39 +00:00
Add missing ensure_list util function
This commit is contained in:
parent
eb730be8f9
commit
39db31b5ae
@ -5,6 +5,7 @@ import requests
|
|||||||
import hashlib
|
import hashlib
|
||||||
import ipaddress
|
import ipaddress
|
||||||
|
|
||||||
|
from collections.abc import Iterable
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
@ -212,6 +213,14 @@ def pretty_json(data):
|
|||||||
return json.dumps(data, sort_keys=True, indent=4)
|
return json.dumps(data, sort_keys=True, indent=4)
|
||||||
|
|
||||||
|
|
||||||
|
def ensure_list(l):
|
||||||
|
if not l:
|
||||||
|
l = []
|
||||||
|
elif not isinstance(l, Iterable) or isinstance(l, str):
|
||||||
|
l = [l]
|
||||||
|
|
||||||
|
yield from l
|
||||||
|
|
||||||
class customBoxes:
|
class customBoxes:
|
||||||
boxes = {
|
boxes = {
|
||||||
"reverse": (" ", " "),
|
"reverse": (" ", " "),
|
||||||
|
Loading…
Reference in New Issue
Block a user