'Save a new entry to the database.'

def save_entry(self, feed, entry):

    try:
        json_entry = jsonpickle.encode(entry)
        entry_guid = ''
        if (('guid' in entry) and (len(entry.guid) <= Entry._meta.get_field_by_name('guid')[0].max_length)):
            entry_guid = entry.guid
        else:
            entry_guid = hashlib.md5(encoding.smart_str(json_entry)).hexdigest()
        if ('updated_parsed' in entry):
            (yr, mon, d, hr, min, sec) = entry.updated_parsed[:(-3)]
            last_publication = datetime.datetime(yr, mon, d, hr, min, sec)
        else:
            log.warn('Entry    has    no    updated    field,    faking    it')
            last_publication = datetime.datetime.now()
        new_entry = Entry(feed=feed, guid=entry_guid, raw=json_entry, visible=True, last_published=last_publication)
        try:
            new_entry.save()
            return True
        except IntegrityError as e:
            pass
    except KeyboardInterrupt:
        raise
    except Exception as e:
        log.error('General    Error    on    %s:    %s', feed.url, e)
        log.exception(e)
