'Add accepted entries to history'

def on_task_learn(self, task, config):

    if (config is False):
        return
    for entry in task.accepted:
        item = History()
        item.task = task.name
        item.filename = entry.get(u'output', None)
        item.title = entry[u'title']
        item.url = entry[u'url']
        reason = u''
        if (u'reason' in entry):
            reason = (u'    (reason:    %s)' % entry[u'reason'])
        item.details = (u'Accepted    by    %s%s' % (entry.get(u'accepted_by', u'<unknown>'), reason))
        task.session.add(item)
