Eolian: Handle None in strings

This commit is contained in:
Kai Huuhko 2014-06-18 10:10:09 +03:00
parent bcac382354
commit 8b59680eec
1 changed files with 4 additions and 4 deletions

View File

@ -18,7 +18,7 @@ handler = logging.StreamHandler()
formatter = logging.Formatter("%(name)s %(levelname)s: %(message)s")
handler.setFormatter(formatter)
log = logging.getLogger("efl.eolian")
log.setLevel(logging.DEBUG)
log.setLevel(logging.INFO)
log.addHandler(handler)
from efl import eolian
@ -51,7 +51,7 @@ param_type_mapping = {
"char *": (
"",
"if isinstance({0}, unicode): {0} = PyUnicode_AsUTF8String({0})",
None
"<{1}>if {0} is not None else NULL"
),
"Eo *": ("_Eo_Base", None, "{0}.obj")
}
@ -251,14 +251,14 @@ class Method(object):
if t in param_type_mapping:
conv = param_type_mapping[t][1]
if conv:
gen.write(conv.format(n))
gen.write(conv.format(n, t))
for i, (t, n) in enumerate(self.c_params):
t = t.replace("const ", "")
if t in param_type_mapping:
conv = param_type_mapping[t][2]
if conv:
self.c_params[i] = (t, conv.format(n))
self.c_params[i] = (t, conv.format(n, t))
c_params = ", ".join([c[1] for c in self.c_params])
c_call = "eo_do(self.obj, %s(%s))" % (self.c_name, c_params)