#from datetime import date, timedelta #from glob import glob #storage = manager.documents['storage'] #when = date.today() #info = manager.document.strip('/').split('/') #if len(info) >= 3 and info[1] != 'draft': # try: # year, month = map(int, info[1:3]) # when = date(year, month, 15) # except ValueError: pass #back = when - timedelta(30) #forw = when + timedelta(30) <table class="blog_calendar"> <tr> <th><a href="`manager.site + '/blog/%d/%02d' % (back.year, back.month)`">«</a></th> <th colspan="5">`when.strftime('%B %Y')`</th> <th><a href="`manager.site + '/blog/%d/%02d' % (forw.year, forw.month)`">»</a></th> </tr> #show = date(when.year, when.month, 1) #until = date(forw.year, forw.month, 1) #step = timedelta(1) <tr> #if show.isoweekday() < 7: # for i in range(show.isoweekday()): <td class="off"></td> #while 1: # path = "/blog/%s" % show.strftime("%Y/%m/%d") # if len(glob(storage.path(manager, path+"*"))): <td class="post"><a href="`manager.site+path`">`show.day`</a></td> # else: <td>`show.day`</td> # pass # show += step # if show.month != when.month: break # if show.isoweekday() == 7: </tr><tr> #for i in range(7-show.isoweekday()): <td class="off"></td> #pass </tr> </table>