示例#1
0
def itemLookupByName(cat_name, item_name):
    """
    Looks up an item based on its human-readable item and category names
    """
    cat = dal.get_category_by_name(cat_name)
    if not cat:
        return not_found_error()

    item = dal.get_item_by_name(cat.cat_id, item_name)
    if not item:
        return not_found_error()

    # All checks passed
    return render("show_item.html", item=item, active_cat=cat_name, active_item=item_name)
示例#2
0
def atomEndpoint():
    """
    Displays recently added items in Atom format.
    Data is formatted as specified in http://atomenabled.org/developers/syndication/
    and was validated against https://validator.w3.org/feed/#validate_by_input/
    """
    last_updated = None
    recent_items = dal.get_recent_items(10)
    # Convert the dates to RFC-3339 format for Atom compatibility
    for i in recent_items:
       i.changed = date_to_atom_friendly(i.changed)
    if recent_items:
        last_updated = recent_items[0].changed
    output = render("atom.xml", last_updated=last_updated, items=recent_items)
    return create_atom_response(output)
示例#3
0
def atomEndpoint():
    """
    Displays recently added items in Atom format.
    Data is formatted as specified in http://atomenabled.org/developers/syndication/
    and was validated against https://validator.w3.org/feed/#validate_by_input/
    """
    last_updated = None
    recent_items = dal.get_recent_items(10)
    # Convert the dates to RFC-3339 format for Atom compatibility
    for i in recent_items:
        i.changed = date_to_atom_friendly(i.changed)
    if recent_items:
        last_updated = recent_items[0].changed
    output = render("atom.xml", last_updated=last_updated, items=recent_items)
    return create_atom_response(output)
示例#4
0
def itemLookupByName(cat_name, item_name):
    """
    Looks up an item based on its human-readable item and category names
    """
    cat = dal.get_category_by_name(cat_name)
    if not cat:
        return not_found_error()

    item = dal.get_item_by_name(cat.cat_id, item_name)
    if not item:
        return not_found_error()

    # All checks passed
    return render("show_item.html",
                  item=item,
                  active_cat=cat_name,
                  active_item=item_name)
示例#5
0
def dashboard():
    """ Serves the splash page for the application. """
    recent_items = dal.get_recent_items(5)
    return render("dashboard.html", recent_items=recent_items)
示例#6
0
def showLogin():
    """ Creates a nonce and displays the page listing available login options. """
    return render("login.html")
示例#7
0
def dashboard():
    """ Serves the splash page for the application. """
    recent_items = dal.get_recent_items(5)
    return render("dashboard.html", recent_items=recent_items)
示例#8
0
def showLogin():
    """ Creates a nonce and displays the page listing available login options. """
    return render("login.html")