[Greater-commits] r3621 - trunk/GREAT-ER-DB/generator/GreaterAPIGenerator
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Jul 20 14:50:48 CEST 2011
Author: aheinecke
Date: 2011-07-20 14:50:47 +0200 (Wed, 20 Jul 2011)
New Revision: 3621
Modified:
trunk/GREAT-ER-DB/generator/GreaterAPIGenerator/helper.py
Log:
stringhelper: - distinguish between the two "%s has to be a string" error
messages
- Do not use internal interpreter functions why are undocumented and
subject to api change.
- Convert unicode strings to UTF-8 encoded strings which we always
use internally in GREAT-ER
Modified: trunk/GREAT-ER-DB/generator/GreaterAPIGenerator/helper.py
===================================================================
--- trunk/GREAT-ER-DB/generator/GreaterAPIGenerator/helper.py 2011-07-20 08:12:59 UTC (rev 3620)
+++ trunk/GREAT-ER-DB/generator/GreaterAPIGenerator/helper.py 2011-07-20 12:50:47 UTC (rev 3621)
@@ -48,9 +48,9 @@
code = ["if (!PyString_Check(%s))" % cpyvar,
"{",
" if (PyUnicode_Check(%s)) {" % cpyvar,
- " %s = _PyUnicode_AsDefaultEncodedString(%s, NULL);" % (cpyvar, cpyvar),
+ " %s = PyUnicode_AsUTF8String(%s);" % (cpyvar, cpyvar),
" if (%s == NULL) {" % cpyvar,
- ' PyErr_Format(PyExc_TypeError, "%s must be a string");' % cvar,
+ ' PyErr_Format(PyExc_TypeError, "%s must be valid unicode");' % cvar,
" goto %s;" % goto,
" }",
" }",
More information about the Greater-commits
mailing list