def remove(): program = optparse.OptionParser( usage = 'qiniu_upload remove [OPTIONS]', add_help_option = False ) program.add_option('--config', '-c', help = 'set config path') program.add_option('--prefix', '-p', help = 'prefix of remote files which you want to remove') options, arguments = program.parse_args() if options.config: if not path.exists(options.config): program.error('config file `%s` not found' % options.config) remove = Remove(options.config, options.prefix) remove.run() else: program.print_help()
def remove(): program = optparse.OptionParser(usage='qiniu_upload remove [OPTIONS]', add_help_option=False) program.add_option('--config', '-c', help='set config path') program.add_option('--prefix', '-p', help='prefix of remote files which you want to remove') options, arguments = program.parse_args() if options.config: if not path.exists(options.config): program.error('config file `%s` not found' % options.config) remove = Remove(options.config, options.prefix) remove.run() else: program.print_help()
def run(mk, rm, mod, find, det, pg, p_opt): db = DB() cliOption = None printOption = None #Check which option is given if mk: cliOption = Make(db, mk) elif rm: cliOption = Remove(db, rm) elif mod: cliOption = Modify(db, mod) elif find: cliOption = Find(db, find) elif det: cliOption = Detail(db, det) elif p_opt: printOption = p_opt #Dummy lines # cur.execute("select * from todo where 1") # rows = cur.fetchall() # if rows: # for row in rows: # iregular = re.compile(r"(\d{4})[-](\d{2})[-](\d{2})\s(\d{2})[:](\d{2})") # iregular2 = re.compile(r"(\d{4})[-](\d{2})[-](\d{2})\s(\d{2})[:](\d{2})") # idue = row[2] # i_match = iregular.match(idue) # t = datetime.datetime.now() # now = iregular2.match(str(t)) # for i in range(1,6): # if int(i_match.group(i)) < int(now.group(i)): # sql = "delete from todo where due = ?" # cur.execute(sql, (i_match.group(0))) # conn.commit() # elif int(i_match.group(i)) > int(now.group(i)): # break if cliOption != None: if cliOption.check(): cliOption.execute() db.conn.close() return Plan(db, pg, printOption).show() db.conn.close()
methods=['GET', 'POST']) app.add_url_rule('/edithostsubmit', view_func=EditHostSubmit.as_view('edithostsubmit'), methods=['GET', 'POST']) app.add_url_rule('/editgroup', view_func=EditGroup.as_view('editgroup'), methods=['GET', 'POST']) app.add_url_rule('/editgroupsubmit', view_func=EditGroupSubmit.as_view('editgroupsubmit'), methods=['GET', 'POST']) app.add_url_rule('/getgroup', view_func=GetGroup.as_view('getgroup'), methods=['GET', 'POST']) app.add_url_rule('/getallgroups', view_func=GetAllGroups.as_view('getallgroups'), methods=['POST','GET']) app.add_url_rule('/addgroups', view_func=AddGroup.as_view('addgroup'), methods=['GET', 'POST']) app.add_url_rule('/remove', view_func=Remove.as_view('remove'), methods=['GET', 'POST'])
route method of flask with '/' as landing page """ app.add_url_rule('/', view_func=Home.as_view('home'), methods=['GET']) """ route method of flask with '/add' as the page to list all recipes """ app.add_url_rule('/index/', view_func=Index.as_view('index'), methods=["GET"]) """ route method of flask with '/add' as the page to add recipe """ app.add_url_rule('/add/', view_func=Add.as_view('add'), methods=['GET', 'POST']) """ route method of flask with '/remove' as the page to remove recipe """ app.add_url_rule('/remove/', view_func=Remove.as_view('remove'), methods=['GET', 'POST']) if __name__ == '__main__': app.run(host='0.0.0.0', port=8000, debug=True)