(domain, content)
return result
:param content: An instance of a subclass of corehq.messaging.scheduling.models.abstract.Content
:param content: An instance of a subclass of corehq.messaging.scheduling.models.abstract.Content
: param content : An instance of a subclass of corehq . messaging . scheduling . models . abstract . Content
def compute_initial(domain, content):
        """
        :param content: An instance of a subclass of corehq.messaging.scheduling.models.abstract.Content
        """
        result = {}
        if isinstance(content, SMSContent):
            result['message'] = content.message
        elif isinstance(content, EmailContent):
            result['subject'] = content.subject
            result['message'] = content.message
        elif isinstance(content, SMSSurveyContent):
            result['app_and_form_unique_id'] = get_combined_id(
                content.app_id,
                content.form_unique_id
            )
            result['survey_expiration_in_hours'] = content.expire_after // 60
            if (content.expire_after % 60) != 0:
                # The old framework let you enter minutes. If it's not an even number of hours, round up.
                result['survey_expiration_in_hours'] += 1

            if content.reminder_intervals:
                result['survey_reminder_intervals_enabled'] = 'Y'
                result['survey_reminder_intervals'] = \
                    ', '.join(str(i) for i in content.reminder_intervals)
            else:
                result['survey_reminder_intervals_enabled'] = 'N'
        elif isinstance(content, CustomContent):
            result['custom_sms_content_id'] = content.custom_content_id
        elif isinstance(content, IVRSurveyContent):
            result['app_and_form_unique_id'] = get_combined_id(
                content.app_id,
                content.form_unique_id
            )
            result['ivr_intervals'] = ', '.join(str(i) for i in content.reminder_intervals)
            result['max_question_attempts'] = content.max_question_attempts
        elif isinstance(content, SMSCallbackContent):
            result['message'] = content.message
            result['sms_callback_intervals'] = ', '.join(str(i) for i in content.reminder_intervals)
        else:
            raise TypeError("Unexpected content type: %s" % type(content))

        return result
def compute_initial ( domain , content ) : result = { } if isinstance ( content , SMSContent ) : result [ 'message' ] = content . message elif isinstance ( content , EmailContent ) : result [ 'subject' ] = content . subject result [ 'message' ] = content . message elif isinstance ( content , SMSSurveyContent ) : result [ 'app_and_form_unique_id' ] = get_combined_id ( content . app_id , content . form_unique_id ) result [ 'survey_expiration_in_hours' ] = content . expire_after // 60 if ( content . expire_after % 60 ) != 0 : # The old framework let you enter minutes. If it's not an even number of hours, round up. result [ 'survey_expiration_in_hours' ] += 1 if content . reminder_intervals : result [ 'survey_reminder_intervals_enabled' ] = 'Y' result [ 'survey_reminder_intervals' ] = ', ' . join ( str ( i ) for i in content . reminder_intervals ) else : result [ 'survey_reminder_intervals_enabled' ] = 'N' elif isinstance ( content , CustomContent ) : result [ 'custom_sms_content_id' ] = content . custom_content_id elif isinstance ( content , IVRSurveyContent ) : result [ 'app_and_form_unique_id' ] = get_combined_id ( content . app_id , content . form_unique_id ) result [ 'ivr_intervals' ] = ', ' . join ( str ( i ) for i in content . reminder_intervals ) result [ 'max_question_attempts' ] = content . max_question_attempts elif isinstance ( content , SMSCallbackContent ) : result [ 'message' ] = content . message result [ 'sms_callback_intervals' ] = ', ' . join ( str ( i ) for i in content . reminder_intervals ) else : raise TypeError ( "Unexpected content type: %s" % type ( content ) ) return result