Repository: ncclient/ncclient

Issue:
Release 0.6.8 xpath filter incompatible with previous releases
The following code used to work in 0.6.7 and earlier,

```
from ncclient import manager

path = '/a/b/c'

with manager.connect(...) as m:
    reply = m.get('xpath', path)
```
Now this code throws an error
```
  File "test-netconf.py", line 7, in <module>
    reply = m.get(filter=('xpath', path))
  File "/usr/local/lib/python3.8/site-packages/ncclient/manager.py", line 226, in execute
    return cls(self._session,
  File "/usr/local/lib/python3.8/site-packages/ncclient/operations/retrieve.py", line 83, in request
    node.append(util.build_filter(filter))
  File "/usr/local/lib/python3.8/site-packages/ncclient/operations/util.py", line 53, in build_filter
    ns, select = criteria
ValueError: too many values to unpack (expected 2)
```

The path parameter in 0.6.7 used to be a string, even the current document still so specifies. But in the unit test and the code the path is expected as a tuple.

Please consider making this backward compatible, and announce such major changes before releasing it.

Discussion:

Patch:
diff --git a/ncclient/operations/util.py b/ncclient/operations/util.py
index 0d1bb38..b8512f5 100755
--- a/ncclient/operations/util.py
+++ b/ncclient/operations/util.py
@@ -50,9 +50,13 @@ def build_filter(spec, capcheck=None):
     if isinstance(spec, tuple):
         type, criteria = spec
         if type == "xpath":
-            ns, select = criteria
-            rep = new_ele_nsmap("filter", ns, type=type)
-            rep.attrib["select"] = select
+            if isinstance(criteria, tuple):
+                ns, select = criteria
+                rep = new_ele_nsmap("filter", ns, type=type)
+                rep.attrib["select"] = select
+            else:
+                rep = new_ele("filter", type=type)
+                rep.attrib["select"]=criteria
         elif type == "subtree":
             rep = new_ele("filter", type=type)
             rep.append(to_ele(criteria))


Test patch:
diff --git a/test/unit/operations/test_utils.py b/test/unit/operations/test_utils.py
index 45adbd3..fd13fd5 100644
--- a/test/unit/operations/test_utils.py
+++ b/test/unit/operations/test_utils.py
@@ -57,7 +57,16 @@ class TestUtils(unittest.TestCase):
         call = ElementTree.tostring(reply)
         self.assertEqual(call, ElementTree.tostring(to_ele(xml)))
 
-    def test_build_filter_2(self):
+    def test_build_filter_xpath(self):
+        criteria = "configuration/system"
+        filter = ("xpath", criteria)
+        reply = build_filter(filter)
+        call = ElementTree.tostring(reply)
+        node = new_ele("filter", type="xpath")
+        node.attrib["select"] = criteria
+        self.assertEqual(call, ElementTree.tostring(node))
+
+    def test_build_filter_xpath_ns(self):
         select = "configuration/system"
         ns = {"ns0": "http://www.xxx.org"}
         criteria = (ns, select)
@@ -68,7 +77,7 @@ class TestUtils(unittest.TestCase):
         node.attrib["select"] = select
         self.assertEqual(call, ElementTree.tostring(node))
 
-    def test_build_filter_3(self):
+    def test_build_filter_subtree(self):
         criteria =  """<configuration>
             <system>
                 <services/>
@@ -81,7 +90,7 @@ class TestUtils(unittest.TestCase):
         node.append(to_ele(criteria))
         self.assertEqual(call, ElementTree.tostring(node))
 
-    def test_build_filter_4(self):
+    def test_build_filter_other(self):
         criteria =  """<configuration>
             <system>
                 <services/>