我在Node.js中有两个Express控制器,分别为A和B,A具有返回数据的功能。我希望B调用该函数,拦截答案并在重构后返回它。像这样的东西:
A{
search(req,res){...}
}
B{
wrapper(req,res){
A.search(req,?).then((repsonse)=>{
<refactor response>;
res.send(refactoredData);
})
}
}
我不知道如何从B调用A.search,并且我不想更改A,A.search中没有next(),如果我调用A.search(req,res )和包装程序的参数,我只是重定向了呼叫,对吧?
答案 0 :(得分:1)
import glob
from lxml import etree
root = etree.Element("root")
with open ('D:\path\result\output.xml', 'w') as out_file:
for inputfile in glob.glob('D:\path\to\scan\**\project_information.xml', recursive=True):
with open (inputfile, "r") as in_file:
project = etree.SubElement(root, "project", path=in_file)
# ... continue with your processing
root.write(out_file, pretty_print=True)