从 zope 目录调用派生的平面列表构建树结构,无需递归
我拥有所有被查找的对象,以便为解释器提供父对象和对象子对象。我希望在不使用递归的情况下完成此操作,因为 zope 不喜欢这种传统的递归。
我将视图上下文设置为递归的根对象,以开始附加对象,然后迭代此过滤后的 intid/对象列表,查找将此对象作为父对象的对象。从那里我寻求起始代码,希望有人帮助我。
I have all objects which get looked up to provide interpreter with both parents objects and object subobjects. I hope to do this without recursion for zope not appreciating this conventional recursion.
I set the view context as root object for recursion to start attaching object on then iterate across this filtered list of intid/objects looking for object that has this object as parent. From there I seek starter code with hopes someone help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许这个小技巧对你和对我都有用。
您可以通过 PathIndex (getPhysicalPath) 限制搜索结果,然后按字母顺序排序:
您将看到类似这样的内容:
我认为从这个输出中您可以轻松构建树结构
Maybe this little trick will be usefull for you as it was for me.
You can restrict your search results by PathIndex (getPhysicalPath) and then just sort it alphabetically:
You will see something like this:
I think from this output you can easy build a tree structure