Exemple #1
0
 def __init__(self,
              this_db='data.db',
              liang_db={
                  'user': '******',
                  'host': 'localhost',
                  'database': 'reactome'
              }):
     SqliteDatabase.__init__(self, this_db)
     self.liang_db = liang_db
Exemple #2
0
def CreateDummyDB():
    db = SqliteDatabase('/tmp/dummy.sqlite', 'w')
    db.CreateTable(
        'tecan_readings',
        'exp_id TEXT, plate TEXT, reading_label TEXT, row INT, col INT, time INT, measurement REAL',
        drop_if_exists=False)
    db.CreateTable('tecan_labels',
                   'exp_id TEXT, plate INT, row INT, col INT, label TEXT',
                   drop_if_exists=False)
    db.CreateTable(
        'tecan_plates',
        'exp_id TEXT, plate INT, description TEXT, owner TEXT, project TEXT',
        drop_if_exists=False)
    db.CreateTable('tecan_experiments',
                   'exp_id TEXT, serial_number TEXT, desciption TEXT',
                   drop_if_exists=False)
    db.CreateTable('tecan_scripts',
                   'exp_id TEXT, script BLOB',
                   drop_if_exists=False)
    return db
Exemple #3
0
 def __init__(
     self,
     this_db='data.db',
     liang_db={'user': '******', 'host': 'localhost', 'database': 'reactome'}):
   SqliteDatabase.__init__(self, this_db)
   self.liang_db = liang_db
Exemple #4
0
 def start_database_thread(self):
     self.logger.info("Starting camera thread")
     self.database_thread = threads.Database(SqliteDatabase())
     self.database_thread.start()
     return True
Exemple #5
0
from flask import Flask, g, render_template
from admin import admin
from database import SqliteDatabase

app = Flask(__name__)
app.config.from_object('config.DevConfig')


database = SqliteDatabase(app.config['DATABASE'])
database.init_db()

app.register_blueprint(admin, url_prefix='/admin/')


@app.before_request
def before_request():
    """
    Operations done before each request.
    """
    app.config['BLOG_NAME'] = admin.config['BLOG_NAME']
    g.db = database
    g.db.connect_db()


@app.teardown_request
def teardown_request(exception):
    """
    Operations on teardown.
    """
    db = getattr(g, 'db', None)
    db.close_db()
Exemple #6
0
 def __init__(self, location='igep.db'):
   SqliteDatabase.__init__(self, location)
Exemple #7
0
    database.logger.debug("user login now: name:%s,ticket:%s" % (username, ticket))
    if getRememberMeTicket(database, username) == ticket:
        database.userId = database.getUserIdByName(username)
        userSetRememberMe(database)
        return getRememberMeTicket(database, username)
    else:
        return "Ticket error!"


def getRememberMeTicket(database, username):
    str = database.getUserRememberMeTime(username) + username
    return encrypt.getPasswordSHA1(str)


if __name__ == "__main__":
    sql = SqliteDatabase()
    print userLogin(sql, "kitty", encrypt.getPasswordSHA1("1212"))
    print userSetRememberMe(sql)
    print getUserQuestion(sql, "kitty")
    # print isUserAnswerRight(sql,'kitty','123144')
    print resetUserPassword(sql, "kitty", "kitty", "1212")
    print sql.getUserRememberMeTime(getLoginedUserName(sql))
    print getRememberMeTicket(sql, getLoginedUserName(sql))
    # saveUserData(sql,'sdfsdfdaf}','default1',"default2")
    # print getUserFileList(sql)
    # print loadUserData(sql,'filetse','data1')
    # print getLoginedUserName(sql)
    # changeUserPassword(sql,'1212')
    # userLogout(sql)
    # sql.getMaxUserId()
    # sql.isRecordExist('user_list')