Merge lp:~cprov/launchpad/db-cve-2014 into lp:launchpad/db-devel

Proposed by Celso Providelo
Status: Merged
Merged at revision: 12645
Proposed branch: lp:~cprov/launchpad/db-cve-2014
Merge into: lp:launchpad/db-devel
Diff against target: 21 lines (+17/-0)
1 file modified
database/schema/patch-2209-55-0.sql (+17/-0)
To merge this branch: bzr merge lp:~cprov/launchpad/db-cve-2014
Reviewer Review Type Date Requested Status
William Grant db Approve
Review via email: mp+209115@code.launchpad.net

Description of the change

Update DB CVE sequence validator to cope with recent (2014) format changes.

To post a comment you must log in.
Revision history for this message
William Grant (wgrant) :
review: Approve (db)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'database/schema/patch-2209-55-0.sql'
2--- database/schema/patch-2209-55-0.sql 1970-01-01 00:00:00 +0000
3+++ database/schema/patch-2209-55-0.sql 2014-03-03 23:43:27 +0000
4@@ -0,0 +1,17 @@
5+-- Copyright 2014 Canonical Ltd. This software is licensed under the
6+-- GNU Affero General Public License version 3 (see the file LICENSE).
7+
8+SET client_min_messages=ERROR;
9+
10+CREATE OR REPLACE FUNCTION valid_cve(text) RETURNS boolean
11+ LANGUAGE plpythonu IMMUTABLE STRICT
12+ AS $_$
13+ import re
14+ name = args[0]
15+ pat = r"^(19|20)\d{2}-\d{4,}$"
16+ if re.match(pat, name):
17+ return 1
18+ return 0
19+$_$;
20+
21+INSERT INTO LaunchpadDatabaseRevision VALUES (2209, 55, 0);

Subscribers

People subscribed via source and target branches

to status/vote changes: