ask to continue import if DB is not empty
This commit is contained in:
parent
5ca3137ddd
commit
162fe78aa6
@ -9,6 +9,11 @@ import textwrap
|
||||
from time import mktime, strptime
|
||||
from collections import defaultdict
|
||||
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
try:
|
||||
from urlparse import urlparse
|
||||
except ImportError:
|
||||
@ -43,6 +48,10 @@ def insert(db, thread, posts):
|
||||
|
||||
def disqus(db, xmlfile):
|
||||
|
||||
if db.execute("SELECT * FROM comments").fetchone():
|
||||
if input("Isso DB is not empty! Continue? [y/N]: ") not in ("y", "Y"):
|
||||
raise SystemExit("Abort.")
|
||||
|
||||
tree = ElementTree.parse(xmlfile)
|
||||
res = defaultdict(list)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user