(domain, user)
return template, args
Generate the data to render the Domain details template.

    :param domain: The name of the Domain to get details for.
    :type domain: str
    :param user: The user requesting this information.
    :type user: CRITsUser
    :returns: template (str), arguments (dict)
Generate the data to render the Domain details template.
Generate the data to render the Domain details template .
def get_domain_details(domain, user):
    """
    Generate the data to render the Domain details template.

    :param domain: The name of the Domain to get details for.
    :type domain: str
    :param user: The user requesting this information.
    :type user: CRITsUser
    :returns: template (str), arguments (dict)
    """

    template = None
    allowed_sources = user_sources(user)
    dmain = Domain.objects(domain=domain,
                           source__name__in=allowed_sources).first()

    if not user.check_source_tlp(dmain):
        dmain = None

    if not dmain:
        error = ("Either no data exists for this domain"
                 " or you do not have permission to view it.")
        template = "error.html"
        args = {'error': error}
        return template, args

    dmain.sanitize(username="%s" % user,
                           sources=allowed_sources)


    # remove pending notifications for user
    remove_user_from_notification("%s" % user, dmain.id, 'Domain')

    # subscription
    subscription = {
            'type': 'Domain',
            'id': dmain.id,
            'subscribed': is_user_subscribed("%s" % user,
                                             'Domain',
                                             dmain.id),
    }

    #objects
    objects = dmain.sort_objects()

    #relationships
    relationships = dmain.sort_relationships("%s" % user, meta=True)

    # relationship
    relationship = {
            'type': 'Domain',
            'value': dmain.id
    }

    #comments
    comments = {'comments': dmain.get_comments(),
                'url_key':dmain.domain}

    #screenshots
    screenshots = dmain.get_screenshots(user)

    # favorites
    favorite = is_user_favorite("%s" % user, 'Domain', dmain.id)

    # services
    service_list = get_supported_services('Domain')

    # analysis results
    service_results = dmain.get_analysis_results()

    args = {'objects': objects,
            'relationships': relationships,
            'comments': comments,
            'favorite': favorite,
            'relationship': relationship,
            'subscription': subscription,
            'screenshots': screenshots,
            'domain': dmain,
            'service_list': service_list,
            'service_results': service_results,
            'DomainACL': DomainACL}

    return template, args
def get_domain_details ( domain , user ) : template = None allowed_sources = user_sources ( user ) dmain = Domain . objects ( domain = domain , source__name__in = allowed_sources ) . first ( ) if not user . check_source_tlp ( dmain ) : dmain = None if not dmain : error = ( "Either no data exists for this domain" " or you do not have permission to view it." ) template = "error.html" args = { 'error' : error } return template , args dmain . sanitize ( username = "%s" % user , sources = allowed_sources ) # remove pending notifications for user remove_user_from_notification ( "%s" % user , dmain . id , 'Domain' ) # subscription subscription = { 'type' : 'Domain' , 'id' : dmain . id , 'subscribed' : is_user_subscribed ( "%s" % user , 'Domain' , dmain . id ) , } #objects objects = dmain . sort_objects ( ) #relationships relationships = dmain . sort_relationships ( "%s" % user , meta = True ) # relationship relationship = { 'type' : 'Domain' , 'value' : dmain . id } #comments comments = { 'comments' : dmain . get_comments ( ) , 'url_key' : dmain . domain } #screenshots screenshots = dmain . get_screenshots ( user ) # favorites favorite = is_user_favorite ( "%s" % user , 'Domain' , dmain . id ) # services service_list = get_supported_services ( 'Domain' ) # analysis results service_results = dmain . get_analysis_results ( ) args = { 'objects' : objects , 'relationships' : relationships , 'comments' : comments , 'favorite' : favorite , 'relationship' : relationship , 'subscription' : subscription , 'screenshots' : screenshots , 'domain' : dmain , 'service_list' : service_list , 'service_results' : service_results , 'DomainACL' : DomainACL } return template , args