Ejemplo n.º 1
0
 def _check_type(self):
     if self._options['type']:
         match = False
         for casetype in common.get_types():
             if self._options['type'].lower() == casetype.lower():
                 match = True
                 self._options['type'] = casetype
                 break
         if (not match):
             msg = _("ERROR: Invalid type specified.")
             print msg
             raise Exception(msg)
Ejemplo n.º 2
0
 def _check_type(self):
     if self._options['type']:
         match = False
         for casetype in common.get_types():
             if self._options['type'].lower() == casetype.lower():
                 match = True
                 self._options['type'] = casetype
                 break
         if(not match):
             msg = _("ERROR: Invalid type specified.")
             print msg
             raise Exception(msg)
Ejemplo n.º 3
0
 def _get_type(self):
     typesAry = common.get_types()
     common.print_types(typesAry)
     while True:
         line = raw_input(_('Please select a type (or \'q\' ' 'to exit): '))
         if str(line).strip() == 'q':
             return False
         try:
             line = int(line)
         # pylint: disable=W0702
         except:
             print _("ERROR: Invalid type selection.")
         if line in range(1, len(typesAry) + 1) and line != '':
             self._options['type'] = typesAry[line - 1]
             break
         else:
             print _("ERROR: Invalid type selection.")
     return True
Ejemplo n.º 4
0
 def _get_type(self):
     typesAry = common.get_types()
     common.print_types(typesAry)
     while True:
         line = raw_input(_('Please select a type (or \'q\' '
                                'to exit): '))
         if str(line).strip() == 'q':
             return False
         try:
             line = int(line)
         # pylint: disable=W0702
         except:
             print _("ERROR: Invalid type selection.")
         if line in range(1, len(typesAry) + 1) and line != '':
             self._options['type'] = typesAry[line - 1]
             break
         else:
             print _("ERROR: Invalid type selection.")
     return True