def onClickOpen(self, sender):
        global has_getAsText
        data = None
        filename = None
        if self.files:
            if self.files.length == 0:
                return
            if self.files.length > 1:
                alert("Cannot open more than one file")
                return
            file = self.files.item(0)
            filename = file.fileName
            try:
                data = file.getAsText("")
            except __HOLE__, e:
                has_getAsText = False
                alert("Sorry. cannot retrieve file in this browser.\nTry again.")
        else:
            elem = self.iframe.getElement()
            # On firefox, this runs into:
            #   Permission denied to get property Window.document
            # when the file is not in the current domain
            body = elem.contentWindow.document.body
            try:
                filename = '' + elem.contentWindow.location
            except:
                filename = None
            if body.childNodes.length == 1:
                data = '' + body.childNodes.item(0).innerHTML
            else:
                data = '' + body.innerHTML
        self.hide()
        if data:
            self.data = data
            self.filename = filename
dataset/ETHPy150Open pyjs/pyjs/examples/timesheet/libtimesheet/view/components/FileOpenDlg.py/FileOpenDlg.onClickOpen