Example #1
0
def _handle_bookmark(info):
    if info['private'] == 'false':
        try:
          mag_bookmark = MagnoliaBookmark.objects.get(magnolia_id=info['id'])
          bookmark = mag_bookmark.bookmark
        except:
          mag_bookmark = MagnoliaBookmark(magnolia_id=info['id'])
          bookmark = Bookmark (
            url = info['url'],
          )

        bookmark.title          = info['title']
        bookmark.description    = info.get('description', '')
        bookmark.screenshot     = info.get('screenshot', '')
        bookmark.date_published = importers.parsedate(info['created'])
        bookmark.date_updated   = importers.parsedate(info['updated'])
        bookmark.rating         = info.get('rating', None)
        bookmark.private        = False
        bookmark.slug           = slugify(info['title'])
        bookmark.tags           = info.get('tags', '')
        bookmark.save()
        try:
          mag_bookmark.bookmark = bookmark
          mag_bookmark.save()
        except:
          bookmark.delete()
Example #2
0
def _handle_bookmark(info):
    try:
      del_bookmark = DeliciousBookmark.objects.get(hash=info['hash'])
      bookmark = del_bookmark.bookmark
    except:
      del_bookmark = DeliciousBookmark(hash=info['hash'])
      bookmark = Bookmark (
        url = info['href'],
      )

    offset                  = 8+settings.UTC_OFFSET
    time_difference         = datetime.timedelta(hours=offset)
    
    bookmark.title          = info['description']
    bookmark.description    = info.get('extended', '')
    bookmark.date_published = importers.parsedate(info['time']) + time_difference
    bookmark.slug           = slugify(info['description'])
    bookmark.tags           = info.get('tag', '')
    bookmark.save()

    del_bookmark.bookmark = bookmark
    del_bookmark.save()