def update_from_form(line): try: change = Change(line) # don't bother with deleted or old documents if change.deleted or not change.is_current(db): return form = XFormInstance.get(change.id) get_formdata_class().create_or_update_from_xforminstance(form) # update the checkpoint, somewhat arbitrarily global sofabed_counter sofabed_counter = sofabed_counter + 1 if sofabed_counter % CHECKPOINT_FREQUENCY == 0: Checkpoint.set_checkpoint(CHECKPOINT_ID, change.seq) except InvalidDataException, e: # this is a less severe class of errors logging.info("bad update in form listener for line: %s\n%s" % (line, e))
def testExtend(self): settings.FORMDATA_MODEL = "forms.FormData" self.assertEqual(FormData, get_formdata_class())
def testExtend(self): settings.FORMDATA_MODEL = "hqsofabed.HQFormData" self.assertEqual(HQFormData, get_formdata_class())