I need to, given an IResource object that&#39;s in a site&#39;s resource tree, get its full URL (in order to generate links to it). Looking in twisted/web/resource.py, it appears that URL traversal is strictly one-way, with resources having no idea what their path component is, nor what their parent resource is.<br>
<br>157         def putChild(self, path, child):<br>158             &quot;&quot;&quot;Register a static child.<br>159     <br>160             You almost certainly don&#39;t want &#39;/&#39; in your path. If you<br>161             intended to have the root of a folder, e.g. /foo/, you want<br>
162             path to be &#39;&#39;.<br>163             &quot;&quot;&quot;<br>164             self.children[path] = child<br>165             child.server = self.server<br><br>If putChild were extended a little bit, it could set some info on the child whenever it&#39;s &quot;placed&quot; into the tree, i.e.<br>
<br>165+       child.parent = self<br>165+       child.path = path<br><br>This would make possible a &quot;getFullPath&quot; method that iterates up the tree to the root, concatenating the parts with &quot;/&quot;.<br><br>
Does anyone see the value of this, if I were to subject such a patch? Obviously this is only relevant for statically-routed resources.<br><br>