Esempio n. 1
0
def bookmarks(page=1):
    if not env.owner or env.owner.id != env.user.id:
        return Response(redirect='%s://%s.%s/%s' % \
                        (env.request.protocol, env.user.login.lower(),
                         settings.domain, env.request.path))
    try:
        page = int(page)
    except (TypeError, ValueError):
        page = 1
    if not page:
        page = 1

    offset = (page - 1) * settings.page_limit

    plist = posts.bookmarks(settings.page_limit+1, offset)

    #if env.request.is_xhr:
    #    for p in plist:
    #        p['created'] = timestamp(p['created'])
    #        p['text'] = html(None, p['text'], True)
    #    return Response(json.dumps(plist), mimetype='application/json')

    section = 'bookmarks'

    return render('/bookmarks.html', section=section, posts=plist, page=page)
Esempio n. 2
0
def bookmarks(page=1):
    if not env.owner or env.owner.id != env.user.id:
        return Response(redirect='%s://%s.%s/%s' % \
                        (env.request.protocol, env.user.login.lower(),
                         settings.domain, env.request.path))
    try:
        page = int(page)
    except (TypeError, ValueError):
        page = 1
    if not page:
        page = 1

    offset = (page - 1) * settings.page_limit

    plist = posts.bookmarks(settings.page_limit + 1, offset)

    #if env.request.is_xhr:
    #    for p in plist:
    #        p['created'] = timestamp(p['created'])
    #        p['text'] = html(None, p['text'], True)
    #    return Response(json.dumps(plist), mimetype='application/json')

    section = 'bookmarks'

    return render('/bookmarks.html', section=section, posts=plist, page=page)
Esempio n. 3
0
def bookmarks(show=None, offset=None, limit=None):
    if offset:
        offset = int(offset)
    if limit:
        limit = int(limit)
    else:
        limit = 10

    plist = posts.bookmarks(offset=offset, limit=limit)
    plist.reverse()

    return xmpp_template('posts', posts=plist)
Esempio n. 4
0
def bookmarks(show=None, offset=None, limit=None):
    if offset:
        offset = int(offset)
    if limit:
        limit = int(limit)
    else:
        limit = 10

    plist = posts.bookmarks(offset=offset, limit=limit)
    plist.reverse()

    return xmpp_template('posts', posts=plist)
Esempio n. 5
0
def bookmarks():
    before = env.request.args("before")
    if before:
        try:
            before = long(before)
        except ValueError:
            before = None

    plist = posts.bookmarks(limit=settings.page_limit + 1, before=before)

    if len(plist) > settings.page_limit:
        plist = plist[:settings.page_limit]
        has_next = True
    else:
        has_next = False

    return {"posts": plist, "has_next": has_next}
Esempio n. 6
0
def bookmarks():
    before = env.request.args("before")
    if before:
        try:
            before = long(before)
        except ValueError:
            before = None

    plist = posts.bookmarks(limit=settings.page_limit + 1, before=before)

    if len(plist) > settings.page_limit:
        plist = plist[: settings.page_limit]
        has_next = True
    else:
        has_next = False

    return {"posts": plist, "has_next": has_next}