def handle(self, *args, **options): domain = since = None if len(args) == 1: domain = args[0] elif len(args) == 2: domain = args[0] since = string_to_datetime(args[1]) else: raise CommandError('Usage: %s\n%s' % (self.args, self.help)) succeeded = [] failed = [] error_messages = defaultdict(lambda: 0) for form in iter_problem_forms(domain, since): print "%s\t%s\t%s\t%s\t%s" % (form._id, form.received_on, form.xmlns, form.xpath('form/meta/username'), form.problem.strip()) if not options["dryrun"]: try: reprocess_form_cases(form) except Exception, e: failed.append(form._id) error_messages[str(e)] += 1 else: succeeded.append(form._id)
def handle(self, *args, **options): if len(args) == 1: id = args[0] else: raise CommandError('Usage: %s\n%s' % (self.args, self.help)) reprocess_form_cases(XFormError.get(id))
def handle(self, *args, **options): domain = since = None if len(args) == 1: domain = args[0] elif len(args) == 2: domain = args[0] since = string_to_datetime(args[1]) else: raise CommandError('Usage: %s\n%s' % (self.args, self.help)) for form in iter_problem_forms(domain, since): print "%s\t%s\t%s\t%s\t%s" % (form._id, form.received_on, form.xmlns, form.xpath('form/meta/username'), form.problem.strip()) if not options["dryrun"]: reprocess_form_cases(form)
def handle(self, *args, **options): if len(args) == 1: filename = args[0] else: raise CommandError('Usage: %s\n%s' % (self.args, self.help)) doc_id_index = HEADERS.index('doc_id') domain_index = HEADERS.index('domain') with open(filename, 'r') as f: reader = csv.reader(f) for row in reader: domain = row[domain_index] doc_id = row[doc_id_index] # don't process the header row if doc_id == "doc_id": continue print 'reprocessing form %s in domain %s' % (doc_id, domain) form = get(doc_id) try: reprocess_form_cases(form) except AssertionError: print 'form %s FAILED' % doc_id