'This method uses file signatures to recognize file types
:param file_path: report file.'

def open_file(self, file_path):

    '\n                                If    you    need    add    support    to    a    new    report    type\n                                add    the    file    signature    here\n                                and    add    the    code    in    self.getRootTag()    for    get    the    root    tag.\n                                '
    f = result = None
    signatures = {'PK': 'zip', '<?xml': 'xml'}
    try:
        if (file_path == None):
            return (None, None)
        f = open(file_path, 'rb')
        file_signature = f.read(10)
        f.seek(0)
        for key in signatures:
            if (file_signature.find(key) == 0):
                result = signatures[key]
                getLogger(self).debug(('Report    type    detected:    %s' % result))
                break
    except IOError as err:
        self.report_type = None
        getLogger(self).error(('Error    while    opening    file.\n%s.    %s' % (err, file_path)))
    return (f, result)
