Example #1
0
    def __init__(self):
        settings = {
            "static_path": os.path.join(os.path.dirname(__file__), 'static'),
            "template_path": os.path.join(os.path.dirname(__file__), 'template'),
            "cookie_secret": "__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
            "login_url": "/login",
            "xsrf_cookies": False,
            "debug": True
        }

        handlers = [
            (r"/", Home),
            (r"/about", About),
            (r"/contact", Contact),
            (r"/user/([^/]+)", User),
            (r"/student", Student),
            (r"/reason", Reason),
            (r"/session_absence", Session_absence),
            (r"/login", Login),
            (r"/logout", Logout),
            (r"/favicon.ico", web.StaticFileHandler, dict(path=settings['static_path'])),
        ]

        web.Application.__init__(self, handlers, **settings)

        self.db = Mongo.conn(options.mongo_host, options.mongo_port)['isima']
Example #2
0
    def __init__(self):
        settings = {
            'static_path': os.path.join(os.path.dirname(__file__), 'static'),
            'template_path': os.path.join(os.path.dirname(__file__), 'template'),
            "debug": True
        }

        handlers = [
            (r'/', Home),
            (r'/classroom', Classroom),
            (r'/curriculum', Curriculum),
            (r'/Teac_Course', Teac_Course),
            (r'/about', About),
            (r'/favicon.ico', tornado.web.StaticFileHandler, dict(path=settings['static_path'])),
        ]

        tornado.web.Application.__init__(self, handlers, **settings)
        self.db = Mongo.conn()['jwcsite']
Example #3
0
#-*-coding: utf-8-*-
# @author: xiangchao<*****@*****.**>

import sys
sys.path.append(sys.path[0] + '/../../')

import datetime
import config
from lib import Mongo

cnn = Mongo.conn()
db = cnn['jwcsite']
table = db.Jiaoshi


def add_day(start_date, adder):
    start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d')
    delta = datetime.timedelta(days=adder)
    result_date = start_date + delta
    return result_date.strftime('%Y-%m-%d')


class Savedb(object):
    def __init__(self, week, campus, data):
        week = int(week)
        tern_start_day = config.tern_start_day
        #week_start_date = add_day(tern_start_day, week * 7)
        self.docs = []
        for room, status in data:
            #把status字符串按照5个5个进行切分
            status = map(lambda x, y: status[x:y], range(0, 35, 5), range(5, 40, 5))