summaryrefslogtreecommitdiffstats
path: root/bindings/python/lang.py
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-02-04 01:23:45 +0000
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2010-02-04 01:23:45 +0000
commit38ef0a86d9075f75ae735409d7b59da2da93490d (patch)
treeebf0084a762eec04b8cc156a3661f32db1243e2e /bindings/python/lang.py
parent2a3ada925ca754dda62e10917fab30e1d9106226 (diff)
downloadlasso-38ef0a86d9075f75ae735409d7b59da2da93490d.tar.gz
lasso-38ef0a86d9075f75ae735409d7b59da2da93490d.tar.xz
lasso-38ef0a86d9075f75ae735409d7b59da2da93490d.zip
Binding python: fix getter for non-object fields
* bindings/python/lang.py: transition to bindings/utils.py methods broke getters.
Diffstat (limited to 'bindings/python/lang.py')
-rw-r--r--bindings/python/lang.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/bindings/python/lang.py b/bindings/python/lang.py
index cbdf17ba..559444d0 100644
--- a/bindings/python/lang.py
+++ b/bindings/python/lang.py
@@ -326,8 +326,10 @@ if WSF_SUPPORT:
print >> fd, ' def get_%s(self):' % mname
print >> fd, ' t = _lasso.%s_%s_get(self._cptr)' % (
klassname, mname)
- if is_object(m):
- print >> fd, ' return cptrToPy(t)'
+ if is_int(m, self.binding_data) or is_xml_node(m) or is_cstring(m) or is_boolean(m):
+ pass
+ elif is_object(m):
+ print >> fd, ' t = cptrToPy(t)'
elif is_glist(m):
el_type = element_type(m)
if is_cstring(el_type):
@@ -356,7 +358,9 @@ if WSF_SUPPORT:
print >> fd, ' return t;'
# setter
print >> fd, ' def set_%s(self, value):' % mname
- if is_object(m):
+ if is_int(m, self.binding_data) or is_xml_node(m) or is_cstring(m) or is_boolean(m):
+ pass
+ elif is_object(m):
print >> fd, ' if value is not None:'
print >> fd, ' value = value and value._cptr'
elif is_glist(m):
@@ -368,6 +372,10 @@ if WSF_SUPPORT:
print >> fd, ' value = tuple([x._cptr for x in value])'
else:
raise Exception('Unsupported python setter %s.%s' % (clss, m))
+ elif is_hashtable(m):
+ print >> sys.stderr, 'W: unsupported setter for hashtable %s' % (m,)
+ else:
+ print >> sys.stderr, 'W: unsupported setter for %s' % (m,)
print >> fd, ' _lasso.%s_%s_set(self._cptr, value)' % (
klassname, mname)
print >> fd, ' %s = property(get_%s, set_%s)' % (mname, mname, mname)
@@ -403,7 +411,7 @@ if WSF_SUPPORT:
print >> fd, ' def get_%s(self):' % mname
function_name = m.name[6:]
- if self.is_pygobject(m.return_type):
+ if is_object(m.return_arg):
print >> fd, ' t = _lasso.%s(self._cptr)' % function_name
print >> fd, ' return cptrToPy(t)'
else:
@@ -499,7 +507,7 @@ if WSF_SUPPORT:
print >> fd, ' if value is not None:'
print >> fd, ' value = tuple([cptrToPy(x) for x in value])'
print >> fd, ' return value'
- elif self.is_pygobject(return_type):
+ elif is_object(m.return_arg):
print >> fd, ' return cptrToPy(_lasso.%s(self._cptr%s))' % (
function_name, c_args)
else: