]> code.communitydata.science - mediawiki_dump_tools.git/commitdiff
added a line to fix persistence with deleted revs
authorBenjamin Mako Hill <mako@atdot.cc>
Fri, 28 Apr 2023 21:21:21 +0000 (14:21 -0700)
committerBenjamin Mako Hill <mako@atdot.cc>
Fri, 28 Apr 2023 21:21:21 +0000 (14:21 -0700)
kaylea realized that we need to initialize the old_rev_data dictionary or it
fails when the first revision to a page is deleted. This patch is from kaylea
and modified by mako.

wikiq

diff --git a/wikiq b/wikiq
index 0543a3383b57ae27281882885bad08978c6de5f9..4a5c129a1078722e58dea1ae99435ef86a5c4ec4 100755 (executable)
--- a/wikiq
+++ b/wikiq
@@ -367,6 +367,8 @@ class WikiqParser():
                     rev_data['collapsed_revs'] = rev.collapsed_revs
 
                 if self.persist != PersistMethod.none:
+                    # initialize an empty dictionary before assigning things into it. this catches bugs if the first revision is deleted                    
+                    old_rev_data = {}
                     if rev.deleted.text:
                         for k in ["token_revs", "tokens_added", "tokens_removed", "tokens_window"]:
                             old_rev_data[k] = None

Community Data Science Collective || Want to submit a patch?