PySvn icon indicating copy to clipboard operation
PySvn copied to clipboard

properties method failed when no props defined

Open agefflot opened this issue 8 years ago • 2 comments

Ask for properties on an element taht does ot have properties defined raise an AttributeError NoneType as no attribute findall

svn\common.py", line 197, in properties for p in target_elem.findall('property')] AttributeError: 'NoneType' object has no attribute 'findall'

Need to robustify I think

agefflot avatar Jul 04 '17 08:07 agefflot

What's the status of this?

keestux avatar Jun 14 '19 12:06 keestux

Perhaps a simple change like this?

diff --git a/svn/common.py b/svn/common.py
index e3dcda6..e6f7c76 100644
--- a/svn/common.py
+++ b/svn/common.py
@@ -157,8 +157,11 @@ class CommonClient(svn.common_base.CommonBase):
         # query the proper list of this path
         root = xml.etree.ElementTree.fromstring(result)
         target_elem = root.find('target')
-        property_names = [p.attrib["name"]
-                          for p in target_elem.findall('property')]
+        if target_elem is not None:
+            property_names = [p.attrib["name"]
+                              for p in target_elem.findall('property')]
+        else:
+            property_names = []
 
         # now query the content of each propery
         property_dict = {}

keestux avatar Jun 14 '19 12:06 keestux