<%doc>Library of common functions used throughout the store <%global> import re <%doc> Method: store_uri Purpose: Writes the base URI of the store application <%method store_uri trim="both"> <% m.interpreter.get_attribute('store_uri') %> <%doc> Method: document_uri Purpose: Writes the base URI of the store's document root <%method document_uri trim="both"> <% m.interpreter.get_attribute('store_document_uri') %> <%doc> Method: category_uri Purpose: Given a Category object, writes the URI to view that category <%method category_uri trim="both"> <%args>category # chop root token off % path = re.sub(r'^/.+?(/|\Z)', '/', category.get_path()) % path = re.sub(r'([^/])$', r'\1/', path) <& SELF:store_uri &>catalog<% path %> <%doc> Method: conditional_bold Purpose: based on a boolean, prints the inside content in boldface or plain <%method conditional_bold trim="both"> <%args>value % if value: <% m.content() %> % else: <% m.content() %> % <%doc> Method: item_link Purpose: Writes a hyperlink with an item's name <%method item_link trim="both"> <%args> item <% item.name %> <%doc> Method: item_image Purpose: Writes the standard HTML to display an item's image <%method item_image> <%args> item
<%doc> Method: price Purpose: Writes a price, or if None does nothing. <%method price trim="both"> <%args> price % if price is not None:  <% '$%.2f' % price %> %