Code adapted from here:
#from 'foo_bar' to 'Foo.Bar'
def lower_case_underscore_to_camel_case(self, string):
print string
class_ = string.__class__
return class_.join('.', map(class_.capitalize, string.split('_')))
Output:
client_area
TypeError: descriptor 'join' requires a 'unicode' object but received a 'str'
Especially disappointing since the source code states:
"""Convert string or unicode from lower-case underscore to camel-case"""
How to fix this?
Easy fix:
return str.join('.', map(class_.capitalize, string.split('_')))
Could anyone explain me the overall process?