Skip to content

inboundxml: unicode string raises an Error in elements #10

@YAmikep

Description

@YAmikep

A unicode string is not handled correctly in inboundxml Elements.
Please see below.
This appears with the Say element but the problem might be global and affect all the elements.

Thanks.

In [51]: str_string = 'test'
In [52]: unicode_string = u'test'

In [53]: print inboundxml.Say(str_string)
<Say>test</Say>

In [54]: print inboundxml.Say(unicode_string)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-54-af1d388959b4> in <module>()
----> 1 print inboundxml.Say(unicode_string)

/python2.7/site-packages/telapi/inboundxml/__init__.pyc in __str__(self)
     29
     30     def __str__(self):
---> 31         return str(unicode(self))
     32
     33     def __unicode__(self):

/python2.7/site-packages/telapi/inboundxml/__init__.pyc in __unicode__(self)
     37         if not self._allow_blank and not body_string.strip():
     38             raise ValueError('The "%s" element cannot be blank!' %
---> 39                 self._element_name)
     40
     41         if len(self._attributes):

ValueError: The "Say" element cannot be blank!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions