Skip to content

Commit 8a12b57

Browse files
committed
Remove name field in DB and fix encoding issue
1 parent f64383f commit 8a12b57

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

utils/make-sqlite.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def nomes_all(where=sys.argv[1:]):
2525
c.execute('''DROP TABLE IF EXISTS rulesets''')
2626
c.execute('''CREATE TABLE rulesets
2727
(id INTEGER PRIMARY KEY,
28-
name TEXT,
2928
contents TEXT)''')
3029
c.execute('''DROP TABLE IF EXISTS targets''')
3130
c.execute('''CREATE TABLE targets
@@ -61,13 +60,9 @@ def nomes_all(where=sys.argv[1:]):
6160

6261
# Store the filename in the `f' attribute so "view source XML" for rules in
6362
# FF version can find it.
64-
try:
65-
tree.xpath("/ruleset")[0].attrib["f"] = os.path.basename(fi)
66-
except Exception as oops:
67-
print "Error setting attribute: f=", os.path.basename(fi), oops
63+
tree.xpath("/ruleset")[0].attrib["f"] = os.path.basename(fi).decode(encoding="UTF-8")
6864

69-
ruleset_name = tree.xpath("/ruleset/@name")[0]
70-
c.execute('''INSERT INTO rulesets (name, contents) VALUES(?, ?)''', (ruleset_name, etree.tostring(tree)));
65+
c.execute('''INSERT INTO rulesets (contents) VALUES(?)''', (etree.tostring(tree),));
7166
ruleset_id = c.lastrowid
7267
for target in targets:
7368
c.execute('''INSERT INTO targets (host, ruleset_id) VALUES(?, ?)''', (target, ruleset_id));

0 commit comments

Comments
 (0)