コード例 #1
0
ファイル: main.py プロジェクト: cgibson/titanium-flea
def single_entry(post_id):

    #cur = g.db.execute('select id, title, urltitle, html, author, created, published from entries where urltitle==?',[urltitle])
    #result = cur.fetchone()
    post = Post.load(g.db, post_id)
    
    # Create a datetime object from our timestamp.
    d = iso8601.parse_date( post["date"] )
    """
    months = ["jan", "feb", "mar", "apr",
              "may", "jun", "jul", "aug", 
              "sep", "oct", "nov", "dec"]
    
    post["created_month"] = months[d.month - 1]
    post["created_day"] = d.day
    """
    
    post["date_str"] = d.strftime("%B %d, %Y")
    
    # Build entry url
    url = "%s/p/%s" % (_app.config["SITE_BASE"], post["_id"])
    post["url"] = url
    
    description = None
    if "description" in post:
        description = post["description"]

    return render_template('single_entry.html', entry=post, util=util, title=post["title"], description=description)