Beispiel #1
0
    def __init__(self):
        br = EL('br')
        basmala = div('\nبسم الله الرحمن الرحيم')
        sakura = a('sakura internet', url='http://www.sakura.ne.jp/')
        python = a('python', url='http://www.python.org/')
        kt3k = a('kt3k', url='http://kt3k.org/')
        image_licenses = a('about image licenses', url='/images/')
        stmp = time_stamp(bracket_style=('"','" JST'))
        self.lamone = div('''
%(br)s%(basmala)s
%(br)s%(stmp)s%(br)s
%(br)s
hosted by%(sakura)s%(br)s
powered by%(python)s%(br)s
%(br)s
Copyright (C) 2005-2012%(kt3k)s
some rights reserved.%(br)s
%(br)s''' % locals())['footer']
Beispiel #2
0
Datei: app.py Projekt: kt3k/cilib
def item(l, dir):
    suf = l.endswith
    st = os.stat(dir+l)
    sz = st.st_size
    if suf('.py'):
        a = chip.a(l,url='/cat?' + dir+l)
        mark = chip.a(pymark, dir+l)
        ln = len(map(lambda x:1,open(dir+l)))
    elif suf('.pyc'):
        a = chip.spangray(l)
        mark = ''
        ln = ''
    elif filter(suf,('.cgi','.ml','.scm')):
        a = chip.a(l,url='/cat?' + dir+l)
        mark = chip.a(xmark, dir+l)
        ln = len(map(lambda x:1,open(dir+l)))
    elif os.path.isdir(dir+l):
        pth = os.path.normpath(dir + l)
        if pth == '.':
            addr = '/ls'
        else:
            addr = '/ls?' + pth + '/'
        a = chip.a(l+'/', url=addr)
        mark = chip.a(dirmark, url=addr)
        ln = ''
        sz = ''
    elif suf('.gif') or suf('.jpg') or suf('.png') or suf('.PNG'):
        a = chip.a(l, url=dir+l)
        mark = chip.a(picmark, url=dir+l)
        ln = ''
    else:
        a = chip.a(l,url='/cat?' + dir+l)
        mark = chip.a(textmark, url='/cat?' + dir+l)
        ln = len(map(lambda x:1,open(dir+l)))
    tm = st.st_mtime
    if recent(tm):
        tm = chip.stamp(tm)
    else:
        tm = chip.stamp(tm).format('%Y/%m/%d')
    return mark, a, tm, ln, sz