Skip to content

Commit

Permalink
Merge pull request bookieio#172 from craigmaloney/fix_tags
Browse files Browse the repository at this point in the history
Reroute the old /tags route to /recent with the tag list.

- Fixes bookieio#170
  • Loading branch information
mitechie committed Jul 29, 2012
2 parents 4239cfa + 6167f2c commit fff295d
Showing 1 changed file with 5 additions and 31 deletions.
36 changes: 5 additions & 31 deletions bookie/views/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from bookie.models import BmarkMgr
from bookie.models import TagMgr
from bookie.views import bmarks

LOG = logging.getLogger(__name__)
RESULTS_MAX = 50
Expand All @@ -26,36 +27,9 @@ def tag_list(request):
}


@view_config(route_name="tag_bmarks", renderer="/tag/bmarks_wrap.mako")
@view_config(route_name="user_tag_bmarks", renderer="/tag/bmarks_wrap.mako")
@view_config(route_name="tag_bmarks", renderer="/bmark/recent.mako")
@view_config(route_name="user_tag_bmarks", renderer="/bmark/recent.mako")
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,
}
# Removed because view was deprecated
return bmarks.recent(request)

0 comments on commit fff295d

Please sign in to comment.