Skip to content

Commit b9f824c

Browse files
committed
Parse stream/wg/file formats from rfc-index.xml; prepare for parsing auth48 info from queue2.xml
- Legacy-Id: 2056
1 parent be4ebc8 commit b9f824c

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

ietf/idrfc/mirror_rfc_index.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
1+
# Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
22
# All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
33
#
44
# Redistribution and use in source and binary forms, with or without
@@ -109,6 +109,15 @@ def getDocList(parentNode, tagName):
109109
updated_by = getDocList(node, "updated-by")
110110
obsoletes = getDocList(node, "obsoletes")
111111
obsoleted_by = getDocList(node, "obsoleted-by")
112+
stream = getChildText(node, "stream")
113+
wg = getChildText(node, "wg_acronym")
114+
if wg and ((wg == "NON WORKING GROUP") or len(wg) > 15):
115+
wg = None
116+
117+
l = []
118+
for format in node.getElementsByTagName("format"):
119+
l.append(getChildText(format, "file-format"))
120+
file_formats = (",".join(l)).lower()
112121

113122
draft = getChildText(node, "draft")
114123
if draft and re.search("-\d\d$", draft):
@@ -119,7 +128,7 @@ def getDocList(parentNode, tagName):
119128
else:
120129
has_errata = 0
121130

122-
data.append([rfc_number,title,authors,rfc_published_date,current_status,updates,updated_by,obsoletes,obsoleted_by,None,draft,has_errata])
131+
data.append([rfc_number,title,authors,rfc_published_date,current_status,updates,updated_by,obsoletes,obsoleted_by,None,draft,has_errata,stream,wg,file_formats])
123132

124133
for d in data:
125134
k = "RFC%04d" % d[0]
@@ -133,7 +142,7 @@ def insert_to_database(data):
133142
log("removing old data...")
134143
cursor.execute("DELETE FROM "+TABLE)
135144
log("inserting new data...")
136-
cursor.executemany("INSERT INTO "+TABLE+" (rfc_number, title, authors, rfc_published_date, current_status,updates,updated_by,obsoletes,obsoleted_by,also,draft,has_errata) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", data)
145+
cursor.executemany("INSERT INTO "+TABLE+" (rfc_number, title, authors, rfc_published_date, current_status,updates,updated_by,obsoletes,obsoleted_by,also,draft,has_errata,stream,wg,file_formats) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", data)
137146
cursor.close()
138147
db.connection._commit()
139148
db.connection.close()

ietf/idrfc/models.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
1+
# Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
22
# All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
33
#
44
# Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,8 @@ class RfcEditorQueue(models.Model):
4848
# this field will be NULL (but we could get it from other sources)
4949
state_date = models.DateField(blank=True,null=True)
5050
stream = models.IntegerField(choices=STREAM_CHOICES)
51+
auth48_url = models.CharField(max_length=200, blank=True, null=True)
52+
rfc_number = models.IntegerField(null=True)
5153
def __str__(self):
5254
return "RfcEditorQueue"+str([self.draft, self.date_received, self.state, self.state_date, self.stream])
5355
class Meta:
@@ -74,6 +76,9 @@ class RfcIndex(models.Model):
7476
also = models.CharField(max_length=50,blank=True,null=True)
7577
draft = models.CharField(max_length=200,null=True)
7678
has_errata = models.BooleanField()
79+
stream = models.CharField(max_length=15,blank=True,null=True)
80+
wg = models.CharField(max_length=15,blank=True,null=True)
81+
file_formats = models.CharField(max_length=20,blank=True,null=True)
7782
def __str__(self):
7883
return "RfcIndex"+str(self.rfc_number)
7984
class Meta:

test/sql_fixup.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
11
-- This file holds needed corrections to the database until they have been applied to
22
-- the live database. This file is applied after importing a new dump of the live DB.
33
DROP TABLE idtracker_areaurl;
4+
5+
ALTER TABLE rfc_editor_queue_mirror ADD COLUMN auth48_url VARCHAR(200);
6+
ALTER TABLE rfc_editor_queue_mirror ADD COLUMN rfc_number INTEGER;
7+
ALTER TABLE rfc_index_mirror ADD COLUMN stream VARCHAR(15);
8+
ALTER TABLE rfc_index_mirror ADD COLUMN wg VARCHAR(15);
9+
ALTER TABLE rfc_index_mirror ADD COLUMN file_formats VARCHAR(20);
10+

0 commit comments

Comments
 (0)