Browse Source

removed some unnecessary comment lines
added a few missing __str__ functions


git-svn-id: svn://bind10.isc.org/svn/bind10/experiments/python-binding@2085 e5f2f494-b856-4b98-b285-d166d9295462

Jelte Jansen 15 years ago
parent
commit
b75fd438e1

+ 9 - 17
src/lib/dns/python/name_python.cc

@@ -40,22 +40,6 @@ static PyObject* po_IscException;
 static PyObject* po_NameRelation;
 
 //
-// Declaration of class constants
-// Initialization and addition of these go in the module init at the
-// end
-//
-/*
-static PyObject* po_MAX_WIRE;
-static PyObject* po_MAX_LABELS;
-static PyObject* po_MAX_LABELLEN;
-static PyObject* po_MAX_COMPRESS_POINTER;
-static PyObject* po_COMPRESS_POINTER_MARK8;
-static PyObject* po_COMPRESS_POINTER_MARK16;
-static PyObject* po_ROOT_NAME;
-*/
-
-
-//
 // Definition of the classes
 //
 
@@ -188,6 +172,7 @@ static void Name_destroy(s_Name* self);
 
 static PyObject* Name_toWire(s_Name* self, PyObject* args);
 static PyObject* Name_toText(s_Name* self);
+static PyObject* Name_str(PyObject* self);
 static PyObject* Name_getLabelCount(s_Name* self);
 static PyObject* Name_at(s_Name* self, PyObject* args);
 static PyObject* Name_getLength(s_Name* self);
@@ -255,7 +240,7 @@ static PyTypeObject name_type = {
     NULL,                               /* tp_as_mapping */
     NULL,                               /* tp_hash  */
     NULL,                               /* tp_call */
-    NULL,                               /* tp_str */
+    Name_str,                           /* tp_str */
     NULL,                               /* tp_getattro */
     NULL,                               /* tp_setattro */
     NULL,                               /* tp_as_buffer */
@@ -417,6 +402,13 @@ Name_toText(s_Name* self)
 }
 
 static PyObject*
+Name_str(PyObject* self)
+{
+    // Simply call the to_text method we already defined
+    return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+}
+
+static PyObject*
 Name_toWire(s_Name* self, PyObject* args)
 {
     PyObject* bytes;

+ 0 - 14
src/lib/dns/python/question_python.cc

@@ -18,20 +18,6 @@
 using namespace isc::dns;
 
 //
-// Declaration of the custom exceptions
-// Initialization and addition of these go in the initModulePart
-// function at the end of this file
-//
-
-//
-// Definition of the classes
-//
-
-// For each class, we need a struct, a helper functions (init, destroy,
-// and static wrappers around the methods we export), a list of methods,
-// and a type description
-
-//
 // Question
 //
 

+ 9 - 1
src/lib/dns/python/rrset_python.cc

@@ -65,6 +65,7 @@ static PyObject* RRset_getTTL(s_RRset* self);
 static PyObject* RRset_setName(s_RRset* self, PyObject* args);
 static PyObject* RRset_setTTL(s_RRset* self, PyObject* args);
 static PyObject* RRset_toText(s_RRset* self);
+static PyObject* RRset_str(PyObject* self);
 static PyObject* RRset_toWire(s_RRset* self, PyObject* args);
 static PyObject* RRset_addRdata(s_RRset* self, PyObject* args);
 static PyObject* RRset_getRdata(s_RRset* self);
@@ -117,7 +118,7 @@ static PyTypeObject rrset_type = {
     NULL,                               /* tp_as_mapping */
     NULL,                               /* tp_hash  */
     NULL,                               /* tp_call */
-    NULL,                               /* tp_str */
+    RRset_str,                          /* tp_str */
     NULL,                               /* tp_getattro */
     NULL,                               /* tp_setattro */
     NULL,                               /* tp_as_buffer */
@@ -312,6 +313,13 @@ RRset_toText(s_RRset* self)
 }
 
 static PyObject*
+RRset_str(PyObject* self)
+{
+    // Simply call the to_text method we already defined
+    return PyObject_CallMethod(self, (char*)"to_text", (char*)"");
+}
+
+static PyObject*
 RRset_toWire(s_RRset* self, PyObject* args)
 {
     PyObject* bytes;