Exemple #1
0
def valid_cve_sequence(value):
    """Check if the given value is a valid CVE otherwise raise an exception.
    """
    if valid_cve(value):
        return True
    else:
        raise LaunchpadValidationError(
            _("${cve} is not a valid CVE number", mapping={'cve': value}))
def valid_cve_sequence(value):
    """Check if the given value is a valid CVE otherwise raise an exception.
    """
    if valid_cve(value):
        return True
    else:
        raise LaunchpadValidationError(_(
            "${cve} is not a valid CVE number", mapping={'cve': value}))
Exemple #3
0
 def __getitem__(self, sequence):
     """See ICveSet."""
     if sequence[:4] in ['CVE-', 'CAN-']:
         sequence = sequence[4:]
     if not valid_cve(sequence):
         return None
     try:
         return Cve.bySequence(sequence)
     except SQLObjectNotFound:
         return None
Exemple #4
0
 def pre_search(self):
     # see if we have an exact match, and redirect if so; otherwise,
     # do a search for it.
     sequence = self.text
     if sequence[:4].lower() in ['cve-', 'can-']:
         sequence = sequence[4:].strip()
     if valid_cve(sequence):
         # try to find the CVE, and redirect to it if we do
         cveset = getUtility(ICveSet)
         cve = cveset[sequence]
         if cve:
             self.request.response.redirect(canonical_url(cve))
     self.searchrequested = True
Exemple #5
0
 def pre_search(self):
     # see if we have an exact match, and redirect if so; otherwise,
     # do a search for it.
     sequence = self.text
     if sequence[:4].lower() in ['cve-', 'can-']:
         sequence = sequence[4:].strip()
     if valid_cve(sequence):
         # try to find the CVE, and redirect to it if we do
         cveset = getUtility(ICveSet)
         cve = cveset[sequence]
         if cve:
             self.request.response.redirect(canonical_url(cve))
     self.searchrequested = True