Esempio n. 1
0
def new_place(places_typed_gen):
    """
    create a new place
    """
    guid = uuid.generate()
    parts = url_parts()
    my_url = '%s://%s.%s.%s/%s' % (parts['proto'],
                                   parts['host'],
                                   parts['domain'],
                                   parts['tld'],
                                   guid)
    if DEBUG:
        print my_url
    my_title = new_title()
    frec = frecency()
    try:
        place = MozPlaces(
            url=my_url,
            title=my_title,
            rev_host=reverse_host(my_url),
            visit_count=expo(8),  # using 8 for MEAN for the fun of it for now
            hidden=0,
            typed=places_typed_gen.next(),
            favicon=new_favicon(),
            frecency=frec)
        place.save()
        p = MozPlaces.objects.filter(rev_host=place.rev_host)[0]
        return p

    except Exception, e:
        print e
        raise
Esempio n. 2
0
def new_place(places_typed_gen):
    """
    create a new place
    """
    guid = uuid.generate()
    parts = url_parts()
    my_url = '%s://%s.%s.%s/%s' % (parts['proto'], parts['host'],
                                   parts['domain'], parts['tld'], guid)
    if DEBUG:
        print my_url
    my_title = new_title()
    frec = frecency()
    try:
        place = MozPlaces(
            url=my_url,
            title=my_title,
            rev_host=reverse_host(my_url),
            visit_count=expo(8),  # using 8 for MEAN for the fun of it for now
            hidden=0,
            typed=places_typed_gen.next(),
            favicon=new_favicon(),
            frecency=frec)
        place.save()
        p = MozPlaces.objects.filter(rev_host=place.rev_host)[0]
        return p

    except Exception, e:
        print e
        raise
Esempio n. 3
0
def new_favicon():
    """
    create a new, unique favicon
    """
    guid = uuid.generate()
    url = 'http://tld.tld/%s.ico' % guid
    favicon = MozFavicons.objects.create(
        url=url,
        data='wootuyiuyeryuwyerywueyurywueyruuewryueyuryuewyurkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjsdhjshjdhjshdjhjsdhjshjkdhjshjdhjshkjdhsjkhdkjhsjdhjshjhdd;sklfnlk;dnfjnklwmnkldjfklhadlfgjkhrnfjkgb;jlshgn;ruignifng;irgn;srhg;rnv;irn;',
        mime_type='image/png',
        expiration=random_date())
    return favicon
Esempio n. 4
0
def new_favicon():
    """
    create a new, unique favicon
    """
    guid = uuid.generate()
    url = 'http://tld.tld/%s.ico' % guid
    favicon = MozFavicons.objects.create(
        url=url,
        data=
        'wootuyiuyeryuwyerywueyurywueyruuewryueyuryuewyurkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjsdhjshjdhjshdjhjsdhjshjkdhjshjdhjshkjdhsjkhdkjhsjdhjshjhdd;sklfnlk;dnfjnklwmnkldjfklhadlfgjkhrnfjkgb;jlshgn;ruignifng;irgn;srhg;rnv;irn;',
        mime_type='image/png',
        expiration=random_date())
    return favicon