mirror of
https://github.com/djohnlewis/stackdump
synced 2025-04-08 02:33:27 +00:00
Added check in the import script to make sure sites aren't inserted with a site key that clashes with Stackdump URLs, e.g. /search or /media.
This commit is contained in:
parent
84f5a951ed
commit
67f1ac7a3a
@ -620,6 +620,13 @@ if not (site_name and site_key and site_desc and dump_date):
|
|||||||
print 'Use command-line parameters to specify the missing details (listed as None).'
|
print 'Use command-line parameters to specify the missing details (listed as None).'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
# prevent importing sites with keys that clash with method names in the app,
|
||||||
|
# e.g. a site key of 'search' would clash with the Stackdump-wide search page.
|
||||||
|
if site_key in ('search', 'import', 'media'):
|
||||||
|
print 'The site key given, %s, is a reserved word in Stackdump.' % site_key
|
||||||
|
print 'Use the --site-key parameter to specify an alternate site key.'
|
||||||
|
sys.exit(2)
|
||||||
|
|
||||||
# check if site is already in database; if so, purge the data.
|
# check if site is already in database; if so, purge the data.
|
||||||
site = list(Site.select(Site.q.key==site_key))
|
site = list(Site.select(Site.q.key==site_key))
|
||||||
if len(site) > 0:
|
if len(site) > 0:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user