-
Notifications
You must be signed in to change notification settings - Fork 766
Issue 341: Update return values for TwiML code. #355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 341: Update return values for TwiML code. #355
Conversation
twilio/twiml/messaging_response.py
Outdated
@@ -7,7 +7,7 @@ class MessagingResponse(TwiML): | |||
""" | |||
def __init__(self): | |||
""" | |||
Create a new <Response> | |||
Create a new <MessagingResponse> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
str(MessagingResponse())
returns <Response>
, but I'm not sure if we want to be general or specific.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what I'm seeing:
In [2]: vr = VoiceResponse()
In [3]: type(vr)
Out[3]: twilio.twiml.voice_response.VoiceResponse
In [4]: str(vr)
Out[4]: '<?xml version="1.0" encoding="UTF-8"?><Response />'
In [5]: from twilio.twiml.messaging_response import MessagingResponse
In [6]: mr = MessagingResponse()
In [7]: str(mr)
Out[7]: '<?xml version="1.0" encoding="UTF-8"?><Response />'
In [8]: type(mr)
Out[8]: twilio.twiml.messaging_response.MessagingResponse
I suppose it creates a <Response>
tag. It's a good question as to whether we should be specific there in the documentation or not. I wonder what the future holds for TwiML.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you are correct, I was omitting the XML header since it's common to both classes.
twilio/twiml/messaging_response.py
Outdated
@@ -30,7 +30,7 @@ def message(self, | |||
:param action: action URL | |||
:param status_callback: callback URL | |||
:param kwargs: other attributes | |||
:return: <Message> element | |||
:return: <MessagingResponse> element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.append
returns the parent element, in this case MessagingResponse
or a <Response>
element.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, I'm sure. I'll change them to <Response>
pending some more info.
twilio/twiml/messaging_response.py
Outdated
@@ -49,7 +49,7 @@ def redirect(self, url, method=None, **kwargs): | |||
:param url: URL to redirect to | |||
:param method: HTTP method | |||
:param kwargs: other attributes | |||
:return: <Redirect> element | |||
:return: <MessagingResponse> element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be <Response>
.
#341