def delete_p(): '''deleta uma tarefa''' _id = request.forms.get('id') core.delete(_id) template = ENV.get_template('painel.html') task = core.get_task('2203') return template.render(tasks=task)
def on_message(slack, config, message): # Respond to all types of messages. channel_id = message['channel'] if channel_id[0] in ['C', 'G']: # Channel/group message, make sure foosbot is being addressed. if not re.search("<@{}>".format(config['bot_id']), message['text']): return pass sender = message['user'] text = message['text'].lower() context = core.Context(slack=slack, channel=channel_id, sender=sender, bot_id=config['bot_id'], users=config['users'], matches=loldb.getmatches()) # Look for HELP matches_help = re.search(help_command, text) if matches_help: core.reply_with_message(help_message, context) return # Look for RANK matches_rank = re.search(rank_command, text) if matches_rank: core.rank(context) return # Look for STATS matches_stats = re.search(stats_command, text) if matches_stats: core.stats(users=users_in(matches_stats.group('who')), context=context) return # Look for RESULTS matches_results = re.search(results_command, text) if matches_results: core.results(users=users_in_teams(matches_results.group('who')), score1=matches_results.group('score1'), score2=matches_results.group('score2'), context=context) return # Look for PREDICT matches_predict = re.search(predict_command, text) if matches_predict: core.predict(users=users_in_teams(matches_predict.group('who')), context=context) return # Look for DELETE matches_delete = re.search(delete_command, text) if matches_delete: core.delete(game_id=matches_delete.group('what'), context=context) return core.reply_with_message(didnt_understand_message, context)
def network_delete(iface, ssid, test=''): """ delete a connection scheme from /etc/network/interfaces and sqlite database :param iface: network interface :param ssid: network name :param test: if non-empty, perform deletion in the database only (for tests) :return: JSON response """ core.delete(iface, ssid, _get_db(), db_only=bool(test)) return jsonify(message='deleted {}:{}'.format(iface, ssid), code=200)
def viewdelete(obj, id): var = style("webmaster") var['obj'] = obj var['id'] = id var['manage'] = 'delete' var = delete(var) template = env.get_template("web-res-delete.html") return template.render(var)
def remove_subscription(self, customer_id, service_id): session = Session(engine) filters = {'customer_id': customer_id, 'service_id': service_id} try: status = core.delete(session, Subscription, filters) status['customer'] = self.clean_records( core.get(session, Customer, {'customer_id': customer_id}))[0] status['service'] = self.clean_records( core.get(session, Service, {'service_id': service_id}))[0] session.close() return status except Exception as e: return {'status': 'failure'}
################################################################## elif command == 'create_folder': try: name = sys.argv[2] except IndexError: info() else: create_folder(name) ################################################################## elif command == 'delete': try: name = sys.argv[2] except IndexError: info() else: delete(name) ################################################################## elif command == 'copy': try: name = sys.argv[2] new_name = sys.argv[3] except IndexError: info() else: copy_file(name, new_name) ################################################################## elif command == 'change_dir': print('Текущая директория: ', os.getcwd()) try: new_dir = sys.argv[2] except IndexError:
def remove_agent(self, email): session = Session(engine) filters = {'emal': email} status = core.delete(session, Agent, filters) session.close() return status