def treat(xml, url, name): if xml.find("*/exception") is not None: raise Exception (xml.find("*/exception").text) return False def fail(e, url, name, response, content): import pdb;pdb.set_trace() pass tools.callback = treat tools.fail = fail def compute(action, mode): tools.get_a_page("Benchmark?action=%s&mode=%s" % (action, mode)) tools.login("kevin", "", save_index=False, get_xslt=False, do_static=False) tools.get_choix(5, "Martinique", want_static=False, want_background=False) with open("benchmark.log", "a+") as f: f.write("------------- x%d\n" % REPEAT) action = "TAGS" for mode in ("TAG_USED", "TAG_NUSED", "TAG_ALL", "TAG_NEVER", "TAG_NEVER_EVER", "TAG_GEO"): time = timeit.Timer((lambda:compute(action, mode))).timeit(REPEAT)/REPEAT with open("benchmark.log", "a+") as f: string = "Action: %s, Mode %s, %s" % (action, mode, time) print string f.write(string+"\n")
#!/usr/bin/env python2 import tools tools.login("kevin", "", get_xslt=False, parse_and_transform=False, do_static=False) tools.get_choix(1, "Root", want_static=False, want_background=False, parse_and_transform=False) tools.get_a_page("Database?action=TRUNK", save=False, parse_and_transform=False) page = tools.get_a_page("Database?action=IMPORT", save=False, parse_and_transform=False) correct = "Export OK" in page print "Correct ? %s" % correct exit(0 if correct else 1)
#!/usr/bin/env python2 import tools tools.login("kevin", "") tools.get_choix(9, "Grenoble") tools.get_a_tagSet(390, "Jan et Patricia", full=True, make_index=True, get_related_albums=True)