Пример #1
0
    def compile_response(self):
        root = get_response_element(
            message="Asynchronous restore under way for {}".format(self.username),
            nature=ResponseNature.OTA_RESTORE_PENDING
        )
        sync_tag = get_sync_element()
        sync_tag.append(get_progress_element(**self.progress))
        root.append(sync_tag)

        return ElementTree.tostring(root, encoding='utf-8')
Пример #2
0
    def compile_response(self):
        root = get_response_element(
            message="Asynchronous restore under way for {}".format(self.username),
            nature=ResponseNature.OTA_RESTORE_PENDING
        )
        sync_tag = get_sync_element()
        sync_tag.append(get_progress_element(**self.progress))
        root.append(sync_tag)

        return ElementTree.tostring(root, encoding='utf-8')
Пример #3
0
def get_response(user, created):
    if created:
        text = "Thanks for registering! Your username is %s" % user.username
    else:
        text = "Thanks for updating your information, %s." % user.username
        
    nature = ResponseNature.SUBMIT_USER_REGISTERED if created else \
             ResponseNature.SUBMIT_USER_UPDATED
    response = get_response_element(text, nature=nature)
    response.append(phone_xml.get_registration_element(user.to_casexml_user()))
    return phone_xml.tostring(response)