summaryrefslogtreecommitdiff
path: root/python/string.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-03-23 14:18:44 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-03-23 14:18:44 +0100
commit37650a078f5504dfbc6622d2c06f4435a3302dd4 (patch)
tree35d7df75535420cbe0712a5f7b7b66d61f5e44d1 /python/string.cc
parent2aa709e41d8896ef897863ea9181c409c4c87a8c (diff)
parent3a08cfb10590d5cf5df1f45d94a424ef6a0f674b (diff)
downloadpython-apt-37650a078f5504dfbc6622d2c06f4435a3302dd4.tar.gz
merged from lp:~mvo/python-apt/mvo
Diffstat (limited to 'python/string.cc')
-rw-r--r--python/string.cc16
1 files changed, 15 insertions, 1 deletions
diff --git a/python/string.cc b/python/string.cc
index 8168ea5b..b95ee3eb 100644
--- a/python/string.cc
+++ b/python/string.cc
@@ -38,7 +38,21 @@ PyObject *Python(PyObject *Self,PyObject *Args) \
}
MkStr(StrDeQuote,DeQuoteString);
-MkStr(StrBase64Encode,Base64Encode);
+
+/*
+ * Input bytes(Py3k)/str(Py2), output str.
+ */
+PyObject *StrBase64Encode(PyObject *Self,PyObject *Args) {
+ char *Str = 0;
+ #if PY_MAJOR_VERSION >= 3
+ if (PyArg_ParseTuple(Args,"y",&Str) == 0)
+ #else
+ if (PyArg_ParseTuple(Args,"s",&Str) == 0)
+ #endif
+ return 0;
+ return CppPyString(Base64Encode(Str));
+}
+
MkStr(StrURItoFileName,URItoFileName);
//MkFloat(StrSizeToStr,SizeToStr);