(self, qid)
Do style specific sanity checks on the questionnaire ID.
Do style specific sanity checks on the questionnaire ID.
Do style specific sanity checks on the questionnaire ID .
def validate_questionnaire_id(self, qid):
        """Do style specific sanity checks on the questionnaire ID."""

        if self.defs.style == "classic":
            # The ID needs to be an integer
            try:
                return int(qid)
            except ValueError:
                log.error(_("IDs need to be integers in \"classic\" style!"))
                sys.exit(1)
        elif self.defs.style == "code128":
            # Check each character for validity
            for c in str(qid):
                if not c in defs.c128_chars:
                    log.error(_("Invalid character %s in questionnaire ID \"%s\" in \"code128\" style!") % (c, qid))
                    sys.exit(1)
            return qid
        elif self.defs.style == "custom":
            log.error(_("SDAPS cannot draw a questionnaire ID with the \"custom\" style. Do this yourself somehow!"))
            sys.exit(1)
        elif self.defs.style == "qr":
          return qid
        else:
            AssertionError()
def validate_questionnaire_id ( self , qid ) : if self . defs . style == "classic" : # The ID needs to be an integer try : return int ( qid ) except ValueError : log . error ( _ ( "IDs need to be integers in \"classic\" style!" ) ) sys . exit ( 1 ) elif self . defs . style == "code128" : # Check each character for validity for c in str ( qid ) : if not c in defs . c128_chars : log . error ( _ ( "Invalid character %s in questionnaire ID \"%s\" in \"code128\" style!" ) % ( c , qid ) ) sys . exit ( 1 ) return qid elif self . defs . style == "custom" : log . error ( _ ( "SDAPS cannot draw a questionnaire ID with the \"custom\" style. Do this yourself somehow!" ) ) sys . exit ( 1 ) elif self . defs . style == "qr" : return qid else : AssertionError ( )