mirror of
https://github.com/djohnlewis/stackdump
synced 2025-04-08 02:33:27 +00:00
Added informative message when Stackdump is disabled during a site import.
This commit is contained in:
parent
2954dd47ba
commit
9b9b71077c
python
@ -11,6 +11,11 @@ pre code {
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
h3, h4, h5, h6 {
|
||||||
|
line-height: normal;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
/* don't want it to have a fixed position; so we'll override it */
|
/* don't want it to have a fixed position; so we'll override it */
|
||||||
.topbar {
|
.topbar {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@ -358,12 +363,12 @@ h1.answers {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodata.row {
|
.nodata.row, .importinprogress.row {
|
||||||
margin-top: 50px;
|
margin-top: 50px;
|
||||||
margin-bottom: 20px;
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.nodata h2 {
|
.nodata h2, .importinprogress h2 {
|
||||||
margin-top: 25px;
|
margin-top: 25px;
|
||||||
margin-bottom: 7px;
|
margin-bottom: 7px;
|
||||||
}
|
}
|
||||||
@ -383,4 +388,8 @@ h1.answers {
|
|||||||
|
|
||||||
.nodata pre {
|
.nodata pre {
|
||||||
margin-top: 7px;
|
margin-top: 7px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.importinprogress .subinfo {
|
||||||
|
color: #999999;
|
||||||
}
|
}
|
@ -237,6 +237,13 @@ def error500(error):
|
|||||||
ex = error.exception
|
ex = error.exception
|
||||||
if isinstance(ex, NoSitesImportedError):
|
if isinstance(ex, NoSitesImportedError):
|
||||||
return render_template('nodata.html')
|
return render_template('nodata.html')
|
||||||
|
if isinstance(ex, OperationalError):
|
||||||
|
# if the error is the database is locked, then it is likely that an
|
||||||
|
# import operation is in progress (for SQLite anyway). Return a nice
|
||||||
|
# error page for that.
|
||||||
|
# HACK: the exception object doesn't seem to provide a better way though.
|
||||||
|
if 'database is locked' in ex.args:
|
||||||
|
return render_template('importinprogress.html')
|
||||||
|
|
||||||
# otherwise, return the standard error message
|
# otherwise, return the standard error message
|
||||||
return repr(error)
|
return repr(error)
|
||||||
@ -431,14 +438,11 @@ def get_sites():
|
|||||||
NoSitesImportedError. This error is designed to trigger the 500 error
|
NoSitesImportedError. This error is designed to trigger the 500 error
|
||||||
handler.
|
handler.
|
||||||
'''
|
'''
|
||||||
try:
|
sites = list(Site.select().orderBy('name'))
|
||||||
sites = list(Site.select().orderBy('name'))
|
if len(sites) == 0:
|
||||||
if len(sites) == 0:
|
raise NoSitesImportedError()
|
||||||
raise NoSitesImportedError()
|
|
||||||
|
return sites
|
||||||
return sites
|
|
||||||
except OperationalError as e:
|
|
||||||
raise NoSitesImportedError(e)
|
|
||||||
|
|
||||||
def decode_json_fields(obj):
|
def decode_json_fields(obj):
|
||||||
'''\
|
'''\
|
||||||
|
26
python/src/stackdump/templates/importinprogress.html
Normal file
26
python/src/stackdump/templates/importinprogress.html
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
Stackdump // Site import in progress
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block body %}
|
||||||
|
<div class="row importinprogress">
|
||||||
|
<div class="span16">
|
||||||
|
<h1>Stackdump is currently importing a StackExchange site.</h1>
|
||||||
|
<p>
|
||||||
|
Stackdump is temporarily disabled while a StackExchange site is
|
||||||
|
being imported. It will automatically become available again
|
||||||
|
once the import process has completed. This should take no
|
||||||
|
longer than 12 hours.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p class="subinfo">
|
||||||
|
If this message is appearing and no site is currently being
|
||||||
|
imported, then check the Stackdump web log and ensure Stackdump
|
||||||
|
has access to the configured database.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
Loading…
x
Reference in New Issue
Block a user