File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1080,6 +1080,17 @@ def echo_func(*_args, **_kwargs):
10801080 resource .path = stripped_path
10811081 new_resources_by_path [stripped_path ] = resource
10821082 codebase .resources_by_path = new_resources_by_path
1083+
1084+ # Fix parent() to handle empty parent_path for direct children of root.
1085+ # commoncode's parent() uses `return path and get_resource(path)` which
1086+ # returns '' (empty string) when path is '', breaking tree traversal.
1087+ original_parent = codebase .resource_class .parent
1088+ def patched_parent (self , codebase_arg ):
1089+ parent_path = self .parent_path ()
1090+ if parent_path == '' :
1091+ return codebase_arg .root
1092+ return original_parent (self , codebase_arg )
1093+ codebase .resource_class .parent = patched_parent
10831094
10841095 finally :
10851096 # remove temporary files
You can’t perform that action at this time.
0 commit comments