[glom] Python functions: Fix regression since the switch to boost::python.



commit 3b974b70bd20addd9564e4123553c4d7778b67d3
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Feb 22 14:02:31 2010 +0100

    Python functions: Fix regression since the switch to boost::python.
    
    * glom/python_embed/python_module/py_glom_module.cc: PyRelatedRecord:
    Fix a typo on the getitem() and len() declarations so we can really
    get a related record.

 ChangeLog                                         |    8 ++++++++
 glom/python_embed/python_module/py_glom_module.cc |   10 ++--------
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e39a59e..d414d9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2010-02-22  Murray Cumming  <murrayc murrayc com>
 
+	Python functions: Fix regression since the switch to boost::python.
+
+	* glom/python_embed/python_module/py_glom_module.cc: PyRelatedRecord:
+	Fix a typo on the getitem() and len() declarations so we can really
+	get a related record.
+
+2010-02-22  Murray Cumming  <murrayc murrayc com>
+
 	Python functions: Avoid a crash.
 
 	* glom/python_embed/glom_python.cc:
diff --git a/glom/python_embed/python_module/py_glom_module.cc b/glom/python_embed/python_module/py_glom_module.cc
index 4013997..2b72350 100644
--- a/glom/python_embed/python_module/py_glom_module.cc
+++ b/glom/python_embed/python_module/py_glom_module.cc
@@ -37,8 +37,6 @@ BOOST_PYTHON_MODULE(glom_1_14)
     .add_property("connection", &PyGlomRecord::get_connection)
     .add_property("related", &PyGlomRecord::get_related)
 
-        /* TODO: python still says "TypeError: 'Boost.Python.class' object is unsubscriptable" */
-	        /* This suggests that it should work: http://lists.boost.org/boost-users/2003/08/4750.php */
     .def("__getitem__", &PyGlomRecord::getitem)
     .def("__len__", &PyGlomRecord::len)
   ;
@@ -53,11 +51,7 @@ BOOST_PYTHON_MODULE(glom_1_14)
     .def("count", &PyGlomRelatedRecord::sum, boost::python::args("field_name"), "Count all values in the field in the related records.")
     .def("min", &PyGlomRelatedRecord::sum, boost::python::args("field_name"), "Minimum of all values of the field in the related recordss.")
     .def("max", &PyGlomRelatedRecord::sum, boost::python::args("field_name"), "Maximum of all values of the field in the related records.")
-    .def("__getitem__", &PyGlomRecord::getitem)
-    .def("__len__", &PyGlomRecord::len)
+    .def("__getitem__", &PyGlomRelatedRecord::getitem)
+    .def("__len__", &PyGlomRelatedRecord::len)
   ;
 }
-
-
-
-



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]