BIND 10 trac2908, updated. 827f143ed26198b3726d0921590f8e91fae11b4c [2908] remove ZoneTableIterator_getCurrent/isc.datasrc.get_current

BIND 10 source code commits bind10-changes at lists.isc.org
Tue Jun 11 02:27:11 UTC 2013


The branch, trac2908 has been updated
       via  827f143ed26198b3726d0921590f8e91fae11b4c (commit)
      from  db63f2e09dfa7e2742d06dc72f7bb4d52c3442a1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 827f143ed26198b3726d0921590f8e91fae11b4c
Author: Paul Selkirk <pselkirk at isc.org>
Date:   Mon Jun 10 22:21:06 2013 -0400

    [2908] remove ZoneTableIterator_getCurrent/isc.datasrc.get_current

-----------------------------------------------------------------------

Summary of changes:
 .../python/isc/datasrc/tests/clientlist_test.py    |   12 +++----
 .../isc/datasrc/zonetable_iterator_python.cc       |   36 ++++----------------
 2 files changed, 12 insertions(+), 36 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/python/isc/datasrc/tests/clientlist_test.py b/src/lib/python/isc/datasrc/tests/clientlist_test.py
index f0cfbb4..e90422e 100644
--- a/src/lib/python/isc/datasrc/tests/clientlist_test.py
+++ b/src/lib/python/isc/datasrc/tests/clientlist_test.py
@@ -175,7 +175,7 @@ class ClientListTest(unittest.TestCase):
         self.assertIsNotNone(table)
         iterator = table.get_iterator()
         self.assertIsNotNone(iterator)
-        self.assertRaises(isc.datasrc.Error, iterator.get_current)
+        self.assertEqual(0, len(list(iterator)))
 
         # normal configuration
         self.clist.configure('''[{
@@ -196,16 +196,14 @@ class ClientListTest(unittest.TestCase):
         self.assertIsNotNone(table)
         iterator = table.get_iterator()
         self.assertIsNotNone(iterator)
-        index, origin = iterator.get_current()
-        self.assertEqual(origin.to_text(), "example.org.")
-        self.assertEqual(1, len(list(iterator)))
+        zonelist = list(iterator)
+        self.assertEqual(1, len(zonelist))
+        self.assertEqual(zonelist[0][1], isc.dns.Name("example.org"))
 
         # named datasrc
         table = self.clist.get_zone_table_accessor("MasterFiles", True)
         iterator = table.get_iterator()
-        index, origin = iterator.get_current()
-        self.assertEqual(origin.to_text(), "example.org.")
-        self.assertEqual(1, len(list(iterator)))
+        self.assertEqual(zonelist, list(iterator))
 
         # longer zone list for non-trivial iteration
         self.clist.configure('''[{
diff --git a/src/lib/python/isc/datasrc/zonetable_iterator_python.cc b/src/lib/python/isc/datasrc/zonetable_iterator_python.cc
index a67e5cf..eeb0c27 100644
--- a/src/lib/python/isc/datasrc/zonetable_iterator_python.cc
+++ b/src/lib/python/isc/datasrc/zonetable_iterator_python.cc
@@ -73,26 +73,6 @@ ZoneTableIterator_destroy(s_ZoneTableIterator* const self) {
 // the type definition of the object, since both can use the other
 //
 PyObject*
-ZoneTableIterator_getCurrent(PyObject* po_self, PyObject*) {
-    s_ZoneTableIterator* self = static_cast<s_ZoneTableIterator*>(po_self);
-    try {
-        const isc::datasrc::ZoneSpec& zs = self->cppobj->getCurrent();
-        return (Py_BuildValue("iO", zs.index,
-                              isc::dns::python::createNameObject(zs.origin)));
-    } catch (const std::exception& ex) {
-        // isc::InvalidOperation is thrown when we call getCurrent()
-        // when we are already done iterating ('iterating past end')
-        // We could also simply return None again
-        PyErr_SetString(getDataSourceException("Error"), ex.what());
-        return (NULL);
-    } catch (...) {
-        PyErr_SetString(getDataSourceException("Error"),
-                        "Unexpected exception");
-        return (NULL);
-    }
-}
-
-PyObject*
 ZoneTableIterator_iter(PyObject *self) {
     Py_INCREF(self);
     return (self);
@@ -105,10 +85,16 @@ ZoneTableIterator_next(PyObject* po_self) {
         return (NULL);
     }
     try {
-        PyObject* result = ZoneTableIterator_getCurrent(po_self, NULL);
+        const isc::datasrc::ZoneSpec& zs = self->cppobj->getCurrent();
+        PyObject* result =
+            Py_BuildValue("iO", zs.index,
+                          isc::dns::python::createNameObject(zs.origin));
         self->cppobj->next();
         return (result);
     } catch (const std::exception& exc) {
+        // isc::InvalidOperation is thrown when we call getCurrent()
+        // when we are already done iterating ('iterating past end')
+        // We could also simply return None again
         PyErr_SetString(getDataSourceException("Error"), exc.what());
         return (NULL);
     } catch (...) {
@@ -119,14 +105,6 @@ ZoneTableIterator_next(PyObject* po_self) {
 }
 
 PyMethodDef ZoneTableIterator_methods[] = {
-    { "get_current", ZoneTableIterator_getCurrent, METH_NOARGS,
-"get_current() -> isc.datasrc.ZoneSpec\n\
-\n\
-Return the information of the zone at which the iterator is\
-currently located\n\
-\n\
-This method must not be called once the iterator reaches the end\
-of the zone table.\n" },
     { NULL, NULL, 0, NULL }
 };
 



More information about the bind10-changes mailing list