Example #1
0
def bmark_list(request):
    """Display the list of bookmarks for this tag"""
    rdict = request.matchdict

    # check if we have a page count submitted
    tag = rdict.get('tag')
    page = int(rdict.get('page', 0))

    # verify the tag exists before we go on
    # 404 if the tag isn't found
    exists = TagMgr.find(tags=[tag])

    if not exists:
        raise HTTPNotFound()

    bmarks = BmarkMgr.by_tag(tag,
                           limit=RESULTS_MAX,
                           page=page)

    return {'tag': tag,
             'bmark_list': bmarks,
             'max_count': RESULTS_MAX,
             'count': len(bmarks),
             'page': page,
             'allow_edit': access.edit_enabled(request.registry.settings),
           }
Example #2
0
def bmark_list(request):
    """Display the list of bookmarks for this tag"""
    rdict = request.matchdict

    # check if we have a page count submitted
    tag = rdict.get('tag')
    page = int(rdict.get('page', 0))

    # verify the tag exists before we go on
    # 404 if the tag isn't found
    exists = TagMgr.find(tags=[tag])

    if not exists:
        raise HTTPNotFound()

    bmarks = BmarkMgr.by_tag(tag, limit=RESULTS_MAX, page=page)

    return {
        'tag': tag,
        'bmark_list': bmarks,
        'max_count': RESULTS_MAX,
        'count': len(bmarks),
        'page': page,
        'allow_edit': access.edit_enabled(request.registry.settings),
    }
Example #3
0
def bmark_list(request):
    """Display the list of bookmarks for this tag"""
    rdict = request.matchdict
    params = request.params

    # check if we have a page count submitted
    tags = rdict.get('tags')
    username = rdict.get("username", None)

    page = int(params.get('page', 0))

    # verify the tag exists before we go on
    # 404 if the tag isn't found
    exists = TagMgr.find(tags=tags)

    if not exists:
        raise HTTPNotFound()

    bmarks = BmarkMgr.find(tags=tags,
                           limit=RESULTS_MAX,
                           page=page,
                           username=username)

    return {
             'tags': tags,
             'bmark_list': bmarks,
             'max_count': RESULTS_MAX,
             'count': len(bmarks),
             'page': page,
             'username': username,
           }
Example #4
0
    def run(bmark):
        """Update this bookmark to toread status"""
        if ToRead.read_tag not in bmark.tags:
            res = TagMgr.find(tags=[ToRead.read_tag])
            if res:
                bmark.tags[ToRead.read_tag] = res[0]

        return bmark
Example #5
0
def tag_list(request):
    """Display a list of your tags"""
    tags_found = TagMgr.find()

    return {
        'tag_list': tags_found,
        'tag_count': len(tags_found),
    }
Example #6
0
    def run(bmark):
        """Update this bookmark to toread status"""
        if ToRead.read_tag not in bmark.tags:
            res = TagMgr.find(tags=[ToRead.read_tag])
            if res:
                bmark.tags[ToRead.read_tag] = res[0]

        return bmark
Example #7
0
def tag_list(request):
    """Display a list of your tags"""
    tags_found = TagMgr.find()

    return {
        'tag_list': tags_found,
        'tag_count': len(tags_found),
    }
Example #8
0
def tag_list(request):
    """Display a list of your tags"""
    rdict = request.matchdict
    username = rdict.get("username", None)

    tags_found = TagMgr.find(username=username)

    return {"tag_list": tags_found, "tag_count": len(tags_found), "username": username}
Example #9
0
def tag_list(request):
    """Display a list of your tags"""
    rdict = request.matchdict
    username = rdict.get("username", None)

    tags_found = TagMgr.find(username=username)

    return {
        'tag_list': tags_found,
        'tag_count': len(tags_found),
        'username': username,
    }
Example #10
0
File: tags.py Project: akn/Bookie
def bmark_list(request):
    """Display the list of bookmarks for this tag"""
    route_name = request.matched_route.name
    rdict = request.matchdict
    params = request.params

    # check if we have a page count submitted
    tags = rdict.get('tags')
    page = int(params.get('page', 0))

    # verify the tag exists before we go on
    # 404 if the tag isn't found
    exists = TagMgr.find(tags=tags)

    if not exists:
        raise HTTPNotFound()

    bmarks = BmarkMgr.find(tags=tags,
                           limit=RESULTS_MAX,
                           page=page,)

    if 'ajax' in route_name:
        html = render('bookie:templates/tag/bmarks.mako',
                      {
                         'tags': tags,
                         'bmark_list': bmarks,
                         'max_count': RESULTS_MAX,
                         'count': len(bmarks),
                         'page': page,
                         'allow_edit': access.edit_enabled(request.registry.settings),
                       },
                  request=request)
        return {
            'success': True,
            'message': "",
            'payload': {
                'html': html,
            }
        }

    else:
        return {'tags': tags,
                 'bmark_list': bmarks,
                 'max_count': RESULTS_MAX,
                 'count': len(bmarks),
                 'page': page,
                 'allow_edit': access.edit_enabled(request.registry.settings),
               }