summaryrefslogtreecommitdiff
path: root/python/py_times.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-28 20:49:26 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-28 20:49:26 -0400
commite851c02d2747be0acc336bc278da9e0460b75738 (patch)
treedf813c5c572922cf05a6317b7eb1d6062dedac05 /python/py_times.cc
parent3020f0f8513d8cef04d4a291dc9b5fa50e1b832c (diff)
downloadfork-ledger-e851c02d2747be0acc336bc278da9e0460b75738.tar.gz
fork-ledger-e851c02d2747be0acc336bc278da9e0460b75738.tar.bz2
fork-ledger-e851c02d2747be0acc336bc278da9e0460b75738.zip
Unit test for Python are now auto-generated from the C++ tests.
Diffstat (limited to 'python/py_times.cc')
-rw-r--r--python/py_times.cc22
1 files changed, 15 insertions, 7 deletions
diff --git a/python/py_times.cc b/python/py_times.cc
index 0fc62941..23532cc2 100644
--- a/python/py_times.cc
+++ b/python/py_times.cc
@@ -32,12 +32,6 @@
#include "pyinterp.h"
#include "pyutils.h"
-#include <boost/cast.hpp>
-#include <boost/python/module.hpp>
-#include <boost/python/def.hpp>
-#include <boost/python/to_python_converter.hpp>
-
-#include <Python.h>
#include <datetime.h>
// jww (2007-05-04): Convert time duration objects to PyDelta
@@ -121,12 +115,26 @@ struct datetime_from_python
typedef register_python_conversion<datetime_t, datetime_to_python, datetime_from_python>
datetime_python_conversion;
+datetime_t py_parse_datetime(const string& str) {
+ return parse_datetime(str);
+}
+
+date_t py_parse_date(const string& str) {
+ return parse_date(str);
+}
+
void export_times()
{
- date_python_conversion();
datetime_python_conversion();
+ date_python_conversion();
register_optional_to_python<datetime_t>();
+ register_optional_to_python<date_t>();
+
+ scope().attr("parse_datetime") = &py_parse_datetime;
+ scope().attr("parse_date") = &py_parse_date;
+ scope().attr("current_time") = current_time;
+ scope().attr("current_date") = current_date;
}
} // namespace ledger