mirror of
https://github.com/retspen/webvirtcloud.git
synced 2026-05-28 16:09:40 +00:00
page speed serving enhancements
handle xml doc enhancements
This commit is contained in:
@@ -94,13 +94,7 @@ def get_xml_path(xml, path=None, func=None):
|
||||
ctx = doc.xpathNewContext()
|
||||
|
||||
if path:
|
||||
ret = ctx.xpathEval(path)
|
||||
if ret is not None:
|
||||
if type(ret) == list:
|
||||
if len(ret) >= 1:
|
||||
result = ret[0].content
|
||||
else:
|
||||
result = ret
|
||||
result = get_xpath(ctx, path)
|
||||
|
||||
elif func:
|
||||
result = func(ctx)
|
||||
@@ -115,6 +109,19 @@ def get_xml_path(xml, path=None, func=None):
|
||||
return result
|
||||
|
||||
|
||||
def get_xpath(ctx, path):
|
||||
result = None
|
||||
ret = ctx.xpathEval(path)
|
||||
if ret is not None:
|
||||
if type(ret) == list:
|
||||
if len(ret) >= 1:
|
||||
result = ret[0].content
|
||||
else:
|
||||
result = ret
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def pretty_mem(val):
|
||||
val = int(val)
|
||||
if val > (10 * 1024 * 1024):
|
||||
|
||||
Reference in New Issue
Block a user