示例#1
0
 def initEnv(self):
     commandDict = self.configReader.getDict(self.KEY_COMMAND)
     openDict = self.configReader.getDict(self.KEY_OPEN)
     server = self.configReader.getDict(self.KEY_Server)
     print 'Server is: %s' % str(server)
     self.timeLimit = int(
         self.configReader.readConfig(self.KEY_Client, self.KEY_TIMELIMIT))
     self.excutor = executor(commandDict, openDict)
     self.dbManager = DataBaseManager(server['host'], int(server['port']))
     print 'init finished'
示例#2
0
def index():
    form = contentForm()
    dataBaseManager = DataBaseManager()

    if form.validate_on_submit():

        innerCommand = form.commandInConfig.data
        writeCommand = form.commandInWrite.data
        userName = form.userName.data
        password = form.password.data
        info = {
            'innerCommand': innerCommand,
            'writeCommand': writeCommand,
            'userName': userName,
            'password': password
        }
        dataBaseManager.insert(info)
        return redirect('/')
    return render_template('index.html', form=form)
示例#3
0
def index():
    form = contentForm()
    dataBaseManager = DataBaseManager()
    if form.validate_on_submit():
        innerCommand = form.commandInConfig.data
        writeCommand = form.commandInWrite.data

        if not (innerCommand or writeCommand):
            errorinfo = u'内置命令和自定义代码至少要写一个!'
            return render_template('index.html',
                                   form=form,
                                   errorinfo=errorinfo)
        else:
            info = {
                'innerCommand': innerCommand,
                'writeCommand': writeCommand,
                'run': False
            }
            dataBaseManager.insert(info)
        return redirect('/')
    return render_template('index.html', form=form, errorinfo='')