Heads up, expect the unexpected.

I've started getting the bindings ready for Py3.

I'm going to add two functions, fruni and touni (see below), which
will handle string conversions. Any *_set method taking in strings
will need to wrap the value(s) in fruni and the *_get methods
returning char* wrap them in touni.

Example:
    elm_win_title_set(self.obj, title)
becomes
    elm_win_title_set(self.obj, fruni(title))
and:
    return elm_win_title_get(self.obj)
becomes
    return touni(elm_win_title_get(self.obj))

The definitions of touni and fruni:

cdef unicode touni(char* s):
    return s.decode('UTF-8', 'strict')

cdef char* fruni(s):
    cdef char* c_string
    if isinstance(s, str):
        c_string = s
    elif isinstance(s, unicode):
        string = s.encode('UTF-8')
        c_string = string
    else:
        raise TypeError("Expected str or unicode object, got %s" %
(type(s).__name__))
    return c_string

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to