<s> from corehq . apps . change_feed import topics <EOL> from corehq . apps . change_feed . producer import producer <EOL> from corehq . apps . change_feed import data_sources <EOL> from corehq . form_processor . signals import sql_case_post_save <EOL> from pillowtop . feed . interface import ChangeMeta <EOL> def publish_form_saved ( form ) : <EOL> producer . send_change ( topics . FORM_SQL , change_meta_from_sql_form ( form ) ) <EOL> def change_meta_from_sql_form ( form ) : <EOL> return ChangeMeta ( <EOL> document_id = form . form_id , <EOL> data_source_type = data_sources . FORM_SQL , <EOL> data_source_name = '<STR_LIT>' , <EOL> document_type = form . state , <EOL> document_subtype = form . xmlns , <EOL> domain = form . domain , <EOL> is_deletion = False , <EOL> ) <EOL> def publish_case_saved ( case , send_post_save_signal = True ) : <EOL> """<STR_LIT>""" <EOL> producer . send_change ( topics . CASE_SQL , change_meta_from_sql_case ( case ) ) <EOL> if send_post_save_signal : <EOL> sql_case_post_save . send ( case . __class__ , case = case ) <EOL> def change_meta_from_sql_case ( case ) : <EOL> return ChangeMeta ( <EOL> document_id = case . case_id , <EOL> data_source_type = data_sources . CASE_SQL , <EOL> data_source_name = '<STR_LIT>' , <EOL> document_type = '<STR_LIT>' , <EOL> document_subtype = case . type , <EOL> domain = case . domain , <EOL> is_deletion = False , <EOL> ) <EOL> def publish_case_deleted ( domain , case_id ) : <EOL> producer . send_change ( topics . CASE_SQL , ChangeMeta ( <EOL> document_id = case_id , <EOL> data_source_type = data_sources . CASE_SQL , <EOL> data_source_name = '<STR_LIT>' , <EOL> document_type = '<STR_LIT>' , <EOL> document_subtype = None , <EOL> domain = domain , <EOL> is_deletion = True , <EOL> ) ) </s>
