(block_id=None)
return {'response': c_block.to_xml(), 'filename': filename}
Return the XML data for the given block ID.

    :param block_id: ObjectId of the requested block
    :type poll_id: string
    :returns: dict with keys:
              "response" (str) - The XML
              "filename" (str) - The name of the XML file
Return the XML data for the given block ID.
Return the XML data for the given block ID .
def get_saved_block(block_id=None):
    """
    Return the XML data for the given block ID.

    :param block_id: ObjectId of the requested block
    :type poll_id: string
    :returns: dict with keys:
              "response" (str) - The XML
              "filename" (str) - The name of the XML file
    """

    data = taxii.TaxiiContent.objects(id=block_id).first() # get data from dB

    if data.timerange == 'STIX File Upload':
        filename = data.block_label
        res = data.content
        return {'response': res, 'filename': filename}

    # rebuild XML
    stamp = datetime.strptime(data.block_label, '%Y-%m-%d %H:%M:%S')
    stamp = stamp.replace(tzinfo=pytz.utc)
    filename = "taxii_block-%s-%s.xml"
    filename = filename % (data.feed, stamp.strftime('%Y%m%dT%H%M%S'))
    c_block = tm11.ContentBlock(content_binding = t.CB_STIX_XML_111,
                                timestamp_label = stamp,
                                content = data.content)

    return {'response': c_block.to_xml(), 'filename': filename}
def get_saved_block ( block_id = None ) : data = taxii . TaxiiContent . objects ( id = block_id ) . first ( ) # get data from dB if data . timerange == 'STIX File Upload' : filename = data . block_label res = data . content return { 'response' : res , 'filename' : filename } # rebuild XML stamp = datetime . strptime ( data . block_label , '%Y-%m-%d %H:%M:%S' ) stamp = stamp . replace ( tzinfo = pytz . utc ) filename = "taxii_block-%s-%s.xml" filename = filename % ( data . feed , stamp . strftime ( '%Y%m%dT%H%M%S' ) ) c_block = tm11 . ContentBlock ( content_binding = t . CB_STIX_XML_111 , timestamp_label = stamp , content = data . content ) return { 'response' : c_block . to_xml ( ) , 'filename' : filename }