'Display page based on a username and slug.'

@web.expose
def display_by_username_and_slug(self, trans, username, slug):

    session = trans.sa_session
    user = session.query(model.User).filter_by(username=username).first()
    page = trans.sa_session.query(model.Page).filter_by(user=user, slug=slug, deleted=False).first()
    if (page is None):
        raise web.httpexceptions.HTTPNotFound()
    self.security_check(trans, page, False, True)
    processor = _PageContentProcessor(trans, 'utf-8', 'text/html', self._get_embed_html)
    processor.feed(page.latest_revision.content)
    user_item_rating = 0
    if trans.get_user():
        user_item_rating = self.get_user_item_rating(trans.sa_session, trans.get_user(), page)
        if user_item_rating:
            user_item_rating = user_item_rating.rating
        else:
            user_item_rating = 0
    (ave_item_rating, num_ratings) = self.get_ave_item_rating_data(trans.sa_session, page)
    page_content = unicodify(processor.output(), 'utf-8')
    return trans.fill_template_mako('page/display.mako', item=page, item_data=page_content, user_item_rating=user_item_rating, ave_item_rating=ave_item_rating, num_ratings=num_ratings, content_only=True)
