def __init__(self, history, change_set):
    self.history = history
    self.detailed_msg = ''
    self.change_set = change_set
    if (not history.detail):
        self.detailed_msg = ''
        return
    detail_dict = json.loads(history.detail)
    if (('domain_type' in detail_dict) and ('account_id' in detail_dict)):
        self.detailed_msg = render_template_string('\n                    <table class="table table-bordered table-striped">\n                        <tr><td>Domain type:</td><td>{{ domaintype }}</td></tr>\n                        <tr><td>Account:</td><td>{{ account }}</td></tr>\n                    </table>\n                ', domaintype=detail_dict['domain_type'], account=(Account.get_name_by_id(self=None, account_id=detail_dict['account_id']) if (detail_dict['account_id'] != '0') else 'None'))
    elif ('authenticator' in detail_dict):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped" style="width:565px;">\n                    <thead>\n                        <tr>\n                            <th colspan="3" style="background: rgba({{ background_rgba }});">\n                                <p style="color:white;">User {{ username }} authentication {{ auth_result }}</p>\n                            </th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        <tr>\n                            <td>Authenticator Type:</td>\n                            <td colspan="2">{{ authenticator }}</td>\n                        </tr>\n                        <tr>\n                            <td>IP Address</td>\n                            <td colspan="2">{{ ip_address }}</td>\n                        </tr>\n                    </tbody>\n                </table>\n                ', background_rgba=('68,157,68' if (detail_dict['success'] == 1) else '201,48,44'), username=detail_dict['username'], auth_result=('success' if (detail_dict['success'] == 1) else 'failure'), authenticator=detail_dict['authenticator'], ip_address=detail_dict['ip_address'])
    elif ('add_rrests' in detail_dict):
        self.detailed_msg = ''
    elif (('name' in detail_dict) and ('template' in history.msg)):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Template name:</td><td>{{ template_name }}</td></tr>\n                    <tr><td>Description:</td><td>{{ description }}</td></tr>\n                </table>\n                ', template_name=DetailedHistory.get_key_val(detail_dict, 'name'), description=DetailedHistory.get_key_val(detail_dict, 'description'))
    elif (('Change domain' in history.msg) and ('access control' in history.msg)):
        users_with_access = DetailedHistory.get_key_val(detail_dict, 'user_has_access')
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Users with access to this domain</td><td>{{ users_with_access }}</td></tr>\n                    <tr><td>Number of users:</td><td>{{ users_with_access | length }}</td><tr>\n                </table>\n                ', users_with_access=users_with_access)
    elif (('Created API key' in history.msg) or ('Updated API key' in history.msg)):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Key: </td><td>{{ keyname }}</td></tr>\n                    <tr><td>Role:</td><td>{{ rolename }}</td></tr>\n                    <tr><td>Description:</td><td>{{ description }}</td></tr>\n                    <tr><td>Accessible domains with this API key:</td><td>{{ linked_domains }}</td></tr>\n                    <tr><td>Accessible accounts with this API key:</td><td>{{ linked_accounts }}</td></tr>\n                </table>\n                ', keyname=DetailedHistory.get_key_val(detail_dict, 'key'), rolename=DetailedHistory.get_key_val(detail_dict, 'role'), description=DetailedHistory.get_key_val(detail_dict, 'description'), linked_domains=DetailedHistory.get_key_val(detail_dict, ('domains' if ('domains' in detail_dict) else 'domain_acl')), linked_accounts=DetailedHistory.get_key_val(detail_dict, 'accounts'))
    elif ('Delete API key' in history.msg):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Key: </td><td>{{ keyname }}</td></tr>\n                    <tr><td>Role:</td><td>{{ rolename }}</td></tr>\n                    <tr><td>Description:</td><td>{{ description }}</td></tr>\n                    <tr><td>Accessible domains with this API key:</td><td>{{ linked_domains }}</td></tr>\n                </table>\n                ', keyname=DetailedHistory.get_key_val(detail_dict, 'key'), rolename=DetailedHistory.get_key_val(detail_dict, 'role'), description=DetailedHistory.get_key_val(detail_dict, 'description'), linked_domains=DetailedHistory.get_key_val(detail_dict, 'domains'))
    elif ('Update type for domain' in history.msg):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Domain: </td><td>{{ domain }}</td></tr>\n                    <tr><td>Domain type:</td><td>{{ domain_type }}</td></tr>\n                    <tr><td>Masters:</td><td>{{ masters }}</td></tr>\n                </table>\n                ', domain=DetailedHistory.get_key_val(detail_dict, 'domain'), domain_type=DetailedHistory.get_key_val(detail_dict, 'type'), masters=DetailedHistory.get_key_val(detail_dict, 'masters'))
    elif ('reverse' in history.msg):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Domain Type: </td><td>{{ domain_type }}</td></tr>\n                    <tr><td>Domain Master IPs:</td><td>{{ domain_master_ips }}</td></tr>\n                </table>\n                ', domain_type=DetailedHistory.get_key_val(detail_dict, 'domain_type'), domain_master_ips=DetailedHistory.get_key_val(detail_dict, 'domain_master_ips'))
    elif (DetailedHistory.get_key_val(detail_dict, 'msg') and DetailedHistory.get_key_val(detail_dict, 'status')):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Status: </td><td>{{ history_status }}</td></tr>\n                    <tr><td>Message:</td><td>{{ history_msg }}</td></tr>\n                </table>\n                ', history_status=DetailedHistory.get_key_val(detail_dict, 'status'), history_msg=DetailedHistory.get_key_val(detail_dict, 'msg'))
def __init__(self, history, change_set):
    self.history = history
    self.detailed_msg = 
    self.change_set = change_set
    if (not history.detail):
        self.detailed_msg = 
        return
    detail_dict = json.loads(history.detail)
    if (('domain_type' in detail_dict) and ('account_id' in detail_dict)):
        self.detailed_msg = render_template_string('\n                    <table class="table table-bordered table-striped">\n                        <tr><td>Domain type:</td><td>{{ domaintype }}</td></tr>\n                        <tr><td>Account:</td><td>{{ account }}</td></tr>\n                    </table>\n                ', domaintype=detail_dict['domain_type'], account=(Account.get_name_by_id(self=None, account_id=detail_dict['account_id']) if (detail_dict['account_id'] != '0') else 'None'))
    elif ('authenticator' in detail_dict):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped" style="width:565px;">\n                    <thead>\n                        <tr>\n                            <th colspan="3" style="background: rgba({{ background_rgba }});">\n                                <p style="color:white;">User {{ username }} authentication {{ auth_result }}</p>\n                            </th>\n                        </tr>\n                    </thead>\n                    <tbody>\n                        <tr>\n                            <td>Authenticator Type:</td>\n                            <td colspan="2">{{ authenticator }}</td>\n                        </tr>\n                        <tr>\n                            <td>IP Address</td>\n                            <td colspan="2">{{ ip_address }}</td>\n                        </tr>\n                    </tbody>\n                </table>\n                ', background_rgba=('68,157,68' if (detail_dict['success'] == 1) else '201,48,44'), username=detail_dict['username'], auth_result=('success' if (detail_dict['success'] == 1) else 'failure'), authenticator=detail_dict['authenticator'], ip_address=detail_dict['ip_address'])
    elif ('add_rrests' in detail_dict):
        self.detailed_msg = 
    elif (('name' in detail_dict) and ('template' in history.msg)):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Template name:</td><td>{{ template_name }}</td></tr>\n                    <tr><td>Description:</td><td>{{ description }}</td></tr>\n                </table>\n                ', template_name=DetailedHistory.get_key_val(detail_dict, 'name'), description=DetailedHistory.get_key_val(detail_dict, 'description'))
    elif (('Change domain' in history.msg) and ('access control' in history.msg)):
        users_with_access = DetailedHistory.get_key_val(detail_dict, 'user_has_access')
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Users with access to this domain</td><td>{{ users_with_access }}</td></tr>\n                    <tr><td>Number of users:</td><td>{{ users_with_access | length }}</td><tr>\n                </table>\n                ', users_with_access=users_with_access)
    elif (('Created API key' in history.msg) or ('Updated API key' in history.msg)):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Key: </td><td>{{ keyname }}</td></tr>\n                    <tr><td>Role:</td><td>{{ rolename }}</td></tr>\n                    <tr><td>Description:</td><td>{{ description }}</td></tr>\n                    <tr><td>Accessible domains with this API key:</td><td>{{ linked_domains }}</td></tr>\n                    <tr><td>Accessible accounts with this API key:</td><td>{{ linked_accounts }}</td></tr>\n                </table>\n                ', keyname=DetailedHistory.get_key_val(detail_dict, 'key'), rolename=DetailedHistory.get_key_val(detail_dict, 'role'), description=DetailedHistory.get_key_val(detail_dict, 'description'), linked_domains=DetailedHistory.get_key_val(detail_dict, ('domains' if ('domains' in detail_dict) else 'domain_acl')), linked_accounts=DetailedHistory.get_key_val(detail_dict, 'accounts'))
    elif ('Delete API key' in history.msg):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Key: </td><td>{{ keyname }}</td></tr>\n                    <tr><td>Role:</td><td>{{ rolename }}</td></tr>\n                    <tr><td>Description:</td><td>{{ description }}</td></tr>\n                    <tr><td>Accessible domains with this API key:</td><td>{{ linked_domains }}</td></tr>\n                </table>\n                ', keyname=DetailedHistory.get_key_val(detail_dict, 'key'), rolename=DetailedHistory.get_key_val(detail_dict, 'role'), description=DetailedHistory.get_key_val(detail_dict, 'description'), linked_domains=DetailedHistory.get_key_val(detail_dict, 'domains'))
    elif ('Update type for domain' in history.msg):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Domain: </td><td>{{ domain }}</td></tr>\n                    <tr><td>Domain type:</td><td>{{ domain_type }}</td></tr>\n                    <tr><td>Masters:</td><td>{{ masters }}</td></tr>\n                </table>\n                ', domain=DetailedHistory.get_key_val(detail_dict, 'domain'), domain_type=DetailedHistory.get_key_val(detail_dict, 'type'), masters=DetailedHistory.get_key_val(detail_dict, 'masters'))
    elif ('reverse' in history.msg):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Domain Type: </td><td>{{ domain_type }}</td></tr>\n                    <tr><td>Domain Master IPs:</td><td>{{ domain_master_ips }}</td></tr>\n                </table>\n                ', domain_type=DetailedHistory.get_key_val(detail_dict, 'domain_type'), domain_master_ips=DetailedHistory.get_key_val(detail_dict, 'domain_master_ips'))
    elif (DetailedHistory.get_key_val(detail_dict, 'msg') and DetailedHistory.get_key_val(detail_dict, 'status')):
        self.detailed_msg = render_template_string('\n                <table class="table table-bordered table-striped">\n                    <tr><td>Status: </td><td>{{ history_status }}</td></tr>\n                    <tr><td>Message:</td><td>{{ history_msg }}</td></tr>\n                </table>\n                ', history_status=DetailedHistory.get_key_val(detail_dict, 'status'), history_msg=DetailedHistory.get_key_val(detail_dict, 'msg'))