def main():

    wiki.open(url, 'dustinlee', 'sisa0822')

    pageID = "lecture:%4d:%02d:%s:attendance" % (year, semester, lectureName)
    headerLine = "===== %d년 %d학기 %s 리포트  =======" % (year, semester, lectureNameKorean)

#^  이름  ^  학번  ^  비고 ^


    db = dataset.connect('sqlite:///' + DBfolder + lectureDB + '.db')


    reportInfoTable = db['reportInfo']
    userFileTable = db['userFile']

    reportTable = db['report']
    keys = reportTable.columns[1:]
    keyLine = '^  ' + '  ^  '.join(keys) + '  ^'
    #print(keyLine)

    mainLines = []
    '''
    for row in attendanceTable:
        mainLine = '| ' + ' | '.join([row[key] for key in keys]) + '|'
        print(mainLine)
    '''

    sortedRows = reportTable.find(order_by=['학번'])
    print(sortedRows)

    #mainLines = '\n'.join(['| ' + ' | '.join([row[key] for key in keys]) + ' |' for row in sortedRows])









    # continuous access to row with key is a problem?
    lines = ['|  ' + '  |  '.join([row[key] for key in keys]) + '  |' for row in sortedRows]
    mainLines = '\n'.join(lines)



    sortedRows = reportInfoTable.find(order_by=['date'])
    lines = ['* %s : %s' % (row['date'], row['name']) for row in sortedRows]
    infoLines = '\n'.join(lines)



    pageText = '\n'.join([headerLine, keyLine, mainLines, infoLines])

    print(pageText)

    print("upload to " + url + "doku.php?id=" + pageID)

    wiki.writePage(pageID, pageText)
示例#2
0
def main():

    url = 'http://www.daehyunlee.com/dustinlee_new/'
    #url = 'http://127.0.0.1/dokuwiki/'

    wiki.open(url, 'dustinlee', 'sisa0822')
    year = 2015
    semester = 1
    lectureName = 'gameengineeringintroduction'
    lectureNameKorean = '전공입문'

    pageID = "lecture:%4d:%02d:%s:attendance" % (year, semester, lectureName)

    header = """\
===== %d년 %d학기 %s 출석표 =======

^  이름  ^  학번  ^  비고 ^""" % (year, semester, lectureNameKorean)


    userInfo = extractUserInfo(chatFileName)


    main = '\n'.join(['| %s | %s |' % (studentNo, userInfo[studentNo]) for studentNo in sorted(userInfo.keys())])


    pageText = header + '\n' + main


    print("upload to " + url + "doku.php?id=" + pageID)

    wiki.writePage(pageID, pageText)