mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
page speed serving enhancements
handle xml doc enhancements
This commit is contained in:
parent
9dc9fea2a1
commit
15d7216368
3 changed files with 63 additions and 39 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue