- rev_data = {}
-
- # if the command line args only gave a label (and no regular expression is given)
- if (self.regex_revision_label != None and self.regex_match_revision == None) or (self.regex_comment_label != None and self.regex_match_comment == None):
- sys.exit('The given regex label(s) has no corresponding regex to search for.')
-
- # if there's anything in the list of regex_match_revision
- if self.regex_match_revision is not None:
- if (self.regex_revision_label == None) or (len(self.regex_match_revision) != len(self.regex_revision_label)):
- sys.exit('Each regular expression *must* come with a corresponding label and vice versa.')
-
- # initialize and construct the list of regex-label tuples
- pairs = []
- for i in range(0,len(self.regex_match_revision)):
- pairs.append((self.regex_match_revision[i], self.regex_revision_label[i]))
-
- # for each regex/label pair, we now run matchmake to check and output columns
- for pair in pairs:
- # pair[0] corresponds to the regex, pair[1] to the label
- rev_data = matchmake(rev.text, rev_data, pair[0], pair[1])
-
- # if there's anything in the list of regex_match_comment
- if self.regex_match_comment is not None:
- if (self.regex_comment_label == None) or (len(self.regex_match_comment) != len(self.regex_comment_label)):
- sys.exit('Each regular expression *must* come with a corresponding label and vice versa.')
-
- # initialize and construct the list of regex-label tuples
- pairs = []
- for i in range(0,len(self.regex_match_comment)):
- pairs.append((self.regex_match_comment[i], self.regex_comment_label[i]))
-
- # for each regex/label pair, we now run matchmake to check and output columns
- for pair in pairs:
- # pair[0] corresponds to the regex, pair[1] to the label
- rev_data = matchmake(rev.comment, rev_data, pair[0], pair[1])
-
- # we fill out the rest of the data structure now
- rev_data['revid'] = rev.id
- rev_data['date_time'] = rev.timestamp.strftime('%Y-%m-%d %H:%M:%S')
- rev_data['articleid'] = page.id
- rev_data['editor_id'] = "" if rev.deleted.user == True or rev.user.id is None else rev.user.id
- rev_data['title'] = '"' + page.title + '"'
- rev_data['namespace'] = namespace
- rev_data['deleted'] = "TRUE" if rev.deleted.text else "FALSE"
+ rev_data = {
+ 'revid':rev.id,
+ 'date_time' : rev.timestamp.strftime('%Y-%m-%d %H:%M:%S'),
+ 'articleid' : page.id,
+ 'editor_id' : "" if rev.deleted.user == True or rev.user.id is None else rev.user.id,
+ 'title' : '"' + page.title + '"',
+ 'namespace' : namespace,
+ 'deleted' : "TRUE" if rev.deleted.text else "FALSE"
+ }
+
+ rev_data = self.matchmake(rev, rev_data)