summaryrefslogtreecommitdiff
path: root/python/string.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-02-17 16:17:36 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2010-02-17 16:17:36 +0100
commitd1b2c0fbd34cee0ffced8270149b87def7675b2a (patch)
treef4b8a14fc619b2e6ea297385e289b2549f6f21a4 /python/string.cc
parentc62bdd0b1b633b134ba551847da0c1e8d12115c2 (diff)
parent930f6a2899b0b410777397fb206a8eba8c99100c (diff)
downloadpython-apt-d1b2c0fbd34cee0ffced8270149b87def7675b2a.tar.gz
merged from the debian-sid branch
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);