def commit(self, source, transform):

        _debug("S3Importer.commit(%s, %s)", source, transform)

        session = current.session

        try:
            openFile = open(source, "r")
        except:
            session.error = self.messages.file_open_error % source
            redirect(URL(r=self.request, f=self.function))

        # @todo: manage different file formats
        # @todo: find file format from request.extension
        extension = source.rsplit(".", 1).pop()
        if extension not in ("csv, ""xls", "xlsx", "xlsm"):
            fileFormat = "csv"
        else:
            fileFormat = extension

        # Insert data in the table and get the ID
        try:
            user = session.auth.user.id
        except:
            user = None

        upload_id = self.upload_table.insert(controller=self.controller,
                                             function=self.function,
                                             filename = source,
                                             user_id = user,
                                             status = 1)
        current.db.commit()

        # Create the import job
        result = self._generate_import_job(upload_id,
                                           openFile,
                                           fileFormat,
                                           stylesheet=transform
                                           )
        if result is None:
            if self.error != None:
                if session.error is None:
                    session.error = self.error
                else:
                    session.error += self.error
            if self.warning != None:
                if session.warning is None:
                    session.warning = self.warning
                else:
                    session.warning += self.warning
        else:
            items = self._get_all_items(upload_id, True)
            # Commit the import job
            self._commit_import_job(upload_id, items)
            result = self._update_upload_job(upload_id)

            # Get the results and display
            messages = self.messages
            msg = "%s : %s %s %s" % (source,
                                     messages.commit_total_records_imported,
                                     messages.commit_total_errors,
                                     messages.commit_total_records_ignored)
            msg = msg % result

            flash = session.flash
            if flash is None:
                flash = msg
            else:
                flash += msg

        # @todo: return the upload_id?

    # -------------------------------------------------------------------------
@todo: docstring?
dataset/ETHPy150Open sahana/eden/modules/s3/s3import.py/S3Importer.commit