예제 #1
0
파일: catalog.py 프로젝트: csarradet/fsndp5
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
파일: catalog.py 프로젝트: csarradet/fsndp5
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
파일: catalog.py 프로젝트: csarradet/fsndp3
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
파일: catalog.py 프로젝트: csarradet/fsndp3
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
파일: catalog.py 프로젝트: csarradet/fsndp5
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
파일: catalog.py 프로젝트: csarradet/fsndp5
def showLogin():
    """ Creates a nonce and displays the page listing available login options. """
    return render("login.html")
예제 #7
0
파일: catalog.py 프로젝트: csarradet/fsndp3
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
파일: catalog.py 프로젝트: csarradet/fsndp3
def showLogin():
    """ Creates a nonce and displays the page listing available login options. """
    return render("login.html")