• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python db.db函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中utils.db.db函数的典型用法代码示例。如果您正苦于以下问题:Python db函数的具体用法?Python db怎么用?Python db使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了db函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: saveattendance

def saveattendance():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    if request.form['absent'] != '':
        abss = request.form['absent'].strip().split('_')
    else:
        abss = []
    if request.form['late'] != '':
        lats = request.form['late'].strip().split('_')
    else:
        lats = []
    if request.form['excused'] != '':
        excs = request.form['excused'].strip().split('_')
    else:
        excs = []
    if request.form['exlates'] != '':
        exlates = request.form['exlates'].strip().split('_')
    else:
        exlates = []
    date = request.form['date'].strip()
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    mydb.setMassAttendance( (nameParts[0], nameParts[1], nameParts[2] ),
                    term, abss, lats, excs, exlates, date )
    return "done"
开发者ID:zamansky,项目名称:gradebook-open,代码行数:27,代码来源:app.py


示例2: getassignments

def getassignments():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    assignments = mydb.getAssignments((nameParts[0],nameParts[1],nameParts[2]), term)
    return json.dumps( assignments )
开发者ID:zamansky,项目名称:gradebook-open,代码行数:9,代码来源:app.py


示例3: getinfo

def getinfo(): 
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    student = mydb.getStudent((nameParts[0], nameParts[1], nameParts[2] ), term, request.form['sid'])
    return json.dumps(student['students'])
开发者ID:zamansky,项目名称:gradebook-open,代码行数:9,代码来源:app.py


示例4: changegrade

def changegrade():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    grades = json.loads(request.form['grades'].strip())
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    student = mydb.changeGrade((nameParts[0], nameParts[1], nameParts[2] ), term, request.form['sid'].strip(), request.form['atype'].strip(), grades)
    return json.dumps(student['students'])
开发者ID:zamansky,项目名称:gradebook-open,代码行数:10,代码来源:app.py


示例5: removestudent

def removestudent():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    mydb.removeStudent((nameParts[0], nameParts[1], nameParts[2]),term,
                        request.form['sid'].strip())
    return "done"
开发者ID:zamansky,项目名称:gradebook-open,代码行数:10,代码来源:app.py


示例6: getbackupcsv

def getbackupcsv():
    clsn = request.args.get('classname')
    term = request.args.get('term')
    nameParts = clsn.split("-")    
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    backup = mydb.getBackupCSV((nameParts[0], nameParts[1], nameParts[2]), term)
    response = make_response( backup )
    response.headers['Content-Disposition'] = 'attachment; filename=' + clsn + '-' + term + '-' + str(datetime.date.today()) + '.csv'
    return response
开发者ID:zamansky,项目名称:gradebook-open,代码行数:11,代码来源:app.py


示例7: seated

def seated():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    mydb.setSeated( (nameParts[0], nameParts[1], nameParts[2]), term,
                  request.form["seated"].strip(),
                  request.form['rows'].strip(), request.form['cols'].strip())
    return "seated set"
开发者ID:zamansky,项目名称:gradebook-open,代码行数:11,代码来源:app.py


示例8: createassignmenttypr

def createassignmenttypr():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    atname = request.form['atname'].strip()
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    mydb.addAssignmentType((nameParts[0], nameParts[1], nameParts[2]),term,
                           atname)
    return 'done'
开发者ID:zamansky,项目名称:gradebook-open,代码行数:11,代码来源:app.py


示例9: getallbackupcsv

def getallbackupcsv():
    teacher = session['teacher']
    term = request.args.get('term')
    mydb = db.db();
    classes = mydb.getClasses(teacher, term)
    backup = ''
    for c in classes:
        backup+= mydb.getBackupCSV(c, term) + '\n\n'

    response = make_response( backup )
    response.headers['Content-Disposition'] = 'attachment; filename=' + teacher + '-' + term + '-' + str(datetime.date.today()) + '.csv'
    return response
开发者ID:zamansky,项目名称:gradebook-open,代码行数:12,代码来源:app.py


示例10: backupreset

def backupreset():
    backup = request.files['backupfile']
    backup = backup.read()
    backup = json.loads(backup)
    clsn = backup['code'] + "-" + backup['section'] + '-' + backup['period']
    nameParts = clsn.split("-")    
    term = backup['term']
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    mydb.resetFromBackup(backup)
    return render_template("classview.html", clsname = clsn,trm = term )
开发者ID:zamansky,项目名称:gradebook-open,代码行数:12,代码来源:app.py


示例11: savegradeoptions

def savegradeoptions():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    option = request.form['option'].strip()
    mydb = db.db()

    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    
    mydb.saveGradeOptions((nameParts[0], nameParts[1], nameParts[2]),term, option)
    return "done";
开发者ID:zamansky,项目名称:gradebook-open,代码行数:12,代码来源:app.py


示例12: changeweights

def changeweights():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    weights =  json.loads(request.form['weights'].strip())
    mydb = db.db()

    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    mydb.changeWeights((nameParts[0], nameParts[1], nameParts[2]),term,
                        weights)
    return "done"
开发者ID:zamansky,项目名称:gradebook-open,代码行数:12,代码来源:app.py


示例13: getassignment

def getassignment():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    try:
        assignment = mydb.getAssignment((nameParts[0],nameParts[1],nameParts[2]), term,
                                     request.form['aname'].strip())
        return json.dumps( assignment )
    except:
        return '{"grades":[]}'
开发者ID:zamansky,项目名称:gradebook-open,代码行数:13,代码来源:app.py


示例14: deletegrades

def deletegrades():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    ids = json.loads(request.form['ids'])
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    print ids
    mydb.deleteAssignment( (nameParts[0], nameParts[1], nameParts[2] ),
                           term, ids,
                           request.form['aname'].strip(), request.form['atype'].strip()); 
    return "done"
开发者ID:zamansky,项目名称:gradebook-open,代码行数:13,代码来源:app.py


示例15: gettoday

def gettoday():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    a = mydb.getTodaysAttendance((nameParts[0], nameParts[1], nameParts[2]), term, request.form['date'].strip(), 'absent')
    l = mydb.getTodaysAttendance((nameParts[0], nameParts[1], nameParts[2]), term, request.form['date'].strip(), 'late')
    e = mydb.getTodaysAttendance((nameParts[0], nameParts[1], nameParts[2]), term, request.form['date'].strip(), 'excused')
    el = mydb.getTodaysAttendance((nameParts[0], nameParts[1], nameParts[2]), term, request.form['date'].strip(), 'exlate')
    d = {'absent':a, 'late':l, 'excused':e, 'exlate':el}
    return json.dumps(d)
开发者ID:zamansky,项目名称:gradebook-open,代码行数:13,代码来源:app.py


示例16: backupallreset

def backupallreset():
    backups = request.files['backupfile']
    backups = backups.read().strip().split('\n')    
    mydb = db.db()
    for b in backups:
        backup = json.loads(b)
        clsn = backup['code'] + "-" + backup['section'] + '-' + backup['period']
        nameParts = clsn.split("-")    
        term = backup['term']
        if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
            return 'false'
        mydb.resetFromBackup(backup)
    return render_template("selectclass.html", term = CURRENT_TERM)
开发者ID:zamansky,项目名称:gradebook-open,代码行数:13,代码来源:app.py


示例17: saveinfo

def saveinfo():
    print request.form
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    student = mydb.saveInfo((nameParts[0], nameParts[1], nameParts[2]),
                            term,
                            request.form['sid'].strip(), request.form['nick'].strip(),
                            request.form['id'].strip(), request.form['email'].strip(),
                            request.form['stuyid'].strip(), request.form['hr'].strip())
    return json.dumps(student['students'])
开发者ID:zamansky,项目名称:gradebook-open,代码行数:14,代码来源:app.py


示例18: addstudent

def addstudent():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    mydb.addStudent( (nameParts[0], nameParts[1], nameParts[2] ),term,
                     request.form['first'].strip(), request.form['last'].strip(),
                     request.form['nick'].strip(), request.form['sid'].strip(), 
                     request.form['email'].strip(), int(request.form['row'].strip()),
                     int(request.form['col'].strip() ), request.form['stuyid'].strip(),
                     request.form['hr'].strip());
    return "done"
开发者ID:zamansky,项目名称:gradebook-open,代码行数:14,代码来源:app.py


示例19: savegrades

def savegrades():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    g = json.loads(request.form['grades'].strip())
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'

    mydb.setMassGrades( (nameParts[0], nameParts[1], nameParts[2] ),
                        term,
                        request.form['aname'].strip(), request.form['atype'].strip(), 
                        request.form['apublic'].strip(),
                        float(request.form['points'].strip()), g);
    return "done"
开发者ID:zamansky,项目名称:gradebook-open,代码行数:15,代码来源:app.py


示例20: loadclass

def loadclass():
    clsn = request.form["classname"].strip()
    term = request.form['term'].strip()
    nameParts = clsn.split("-")
    mydb = db.db()
    if session['teacher'] != mydb.getTeacher( (nameParts[0], nameParts[1], nameParts[2] ), term ):
        return 'false'
    
    markUsage( session['teacher'] )
    cls = mydb.getClass( (nameParts[0], nameParts[1], nameParts[2] ), term )
    try:
        mydb.resizeClass( (nameParts[0], nameParts[1], nameParts[2] ),
                          term, request.form["rows"].strip(), request.form["cols"].strip())
    except KeyError:
        pass
    return json.dumps( cls[0] )
开发者ID:zamansky,项目名称:gradebook-open,代码行数:16,代码来源:app.py



注:本文中的utils.db.db函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python db_utils.db函数代码示例发布时间:2022-05-26
下一篇:
Python db.cfmedb函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap