]> git.phdru.name Git - xsetbg.git/blobdiff - reload_db.py
Fix deprecated open mode `rU` -> `r`
[xsetbg.git] / reload_db.py
index ee51b392aedb6048c6cf4dada016ae7cb7f930dd..ff1c3a697386c344c1a94937714ffd05d11fa93b 100755 (executable)
@@ -5,10 +5,6 @@ This file is a part of XSetBg.
 
 """
 
-__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2007-2015 PhiloSoft Design"
-__license__ = "GNU GPL"
-
 import sys
 from sqlobject import SQLObjectNotFound
 from sqlobject.sqlbuilder import Insert
@@ -24,7 +20,7 @@ def convert_str(s):
 
 
 fs_encoding = xsetbg_conf.get("images", "fs_encoding")
-dump_file = open(sys.argv[1], 'rU')
+dump_file = open(sys.argv[1], 'r')
 xsetbg_db = recreate_db()
 count_new = count_old = 0
 
@@ -46,7 +42,8 @@ with SQLiteMassInsert() as txn:
             count_new += 1
         else:
             assert id is None or row.id == id
-            assert row.last_shown == timestamp
+            if row.last_shown is not None:
+                assert row.last_shown == timestamp
             count_old += 1
 
 dump_file.close()