def _load_key(self, key): '''Modify dialog controls to reflect key.''' ids_key = util.parse_ids_key(key) # Silently show invalid IDS keys as text, only refuse them when closing # the dialog. if ids_key is None: self.key_is_text.set_active(True) self.key_text.set_text(key) else: self.key_is_ids.set_active(True) (type_, severity) = ids_key util.set_combo_option(self.key_ids_type, type_) util.set_combo_option(self.key_ids_severity, severity)
def parse_value(string, *unused): if len(string) > audit.AUDIT_MAX_KEY_LEN: raise ParsingError(_('Key value "%s" too long') % string) if util.is_ids_key(string) and util.parse_ids_key(string) is None: raise ParsingError(_('Invalid IDS key "%s"') % string) return string
def _validate_get_failure(self): if self.key_is_text.get_active(): key = self.key_text.get_text() if util.is_ids_key(key) and util.parse_ids_key(key) is None: return (_('Invalid IDS key value'), None, self.key_text) return None