'@todo: docstring?'

def commit(self, 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))
    extension = source.rsplit('.', 1).pop()
    if (extension not in ('csv,    xls', 'xlsx', 'xlsm')):
        fileFormat = 'csv'
    else:
        fileFormat = extension
    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()
    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)
        self._commit_import_job(upload_id, items)
        result = self._update_upload_job(upload_id)
        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)
        confirmation = session.confirmation
        if (confirmation is None):
            confirmation = msg
        else:
            confirmation += msg
