def init_views(): for key in view_list: if key not in views_with_anonymous_access: view_list[key] = login_required(view_list[key]) for key in route_deco: route = route_deco[key] view_method = view_list[key] view_list[key] = route(view_method) log.info(__name__ + ' :: Registered views - {0}'.format(str(view_list)))
def add_model_process(): """ Handles processing of add model """ model_name = request.form['modelName'] if 'modelName' in request.form \ else None model_type = request.form['modelType'] if 'modelType' in request.form \ else None if model_name and model_type: log.info('Added model (type, name) = "%s", "%s" ' % (model_name, model_type)) mysql = DataIOMySQL() mysql.connect() mysql.insert('Model', uid=-1, name=model_name, mtype=model_type, date_create=int(time.time())) else: log.error('Missing model fields in POST data "%s"' % str(request.data)) return render_template('index_anon.html')
def connect(self, **kwargs): """ dialect+driver://username:password@host:port/database """ if self.driver: connect_str = '{0}+{1}://{2}:{3}@{4}/{5}'.format( self.dialect, self.driver, self.user, self.pwrd, self.host, self.db, ) else: connect_str = '{0}://{1}:{2}@{3}/{4}'.format( self.dialect, self.user, self.pwrd, self.host, self.db, ) log.info('Establishing connection to "%s"' % connect_str) self.engine = create_engine(connect_str) self.make_session()