mirror of
https://github.com/djohnlewis/stackdump
synced 2024-12-04 23:17:37 +00:00
Added informative message when Stackdump is disabled during a site import.
This commit is contained in:
parent
2954dd47ba
commit
9b9b71077c
@ -11,6 +11,11 @@ pre code {
|
||||
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 */
|
||||
.topbar {
|
||||
position: absolute;
|
||||
@ -358,12 +363,12 @@ h1.answers {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.nodata.row {
|
||||
.nodata.row, .importinprogress.row {
|
||||
margin-top: 50px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.nodata h2 {
|
||||
.nodata h2, .importinprogress h2 {
|
||||
margin-top: 25px;
|
||||
margin-bottom: 7px;
|
||||
}
|
||||
@ -383,4 +388,8 @@ h1.answers {
|
||||
|
||||
.nodata pre {
|
||||
margin-top: 7px;
|
||||
}
|
||||
|
||||
.importinprogress .subinfo {
|
||||
color: #999999;
|
||||
}
|
@ -237,6 +237,13 @@ def error500(error):
|
||||
ex = error.exception
|
||||
if isinstance(ex, NoSitesImportedError):
|
||||
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
|
||||
return repr(error)
|
||||
@ -431,14 +438,11 @@ def get_sites():
|
||||
NoSitesImportedError. This error is designed to trigger the 500 error
|
||||
handler.
|
||||
'''
|
||||
try:
|
||||
sites = list(Site.select().orderBy('name'))
|
||||
if len(sites) == 0:
|
||||
raise NoSitesImportedError()
|
||||
|
||||
return sites
|
||||
except OperationalError as e:
|
||||
raise NoSitesImportedError(e)
|
||||
sites = list(Site.select().orderBy('name'))
|
||||
if len(sites) == 0:
|
||||
raise NoSitesImportedError()
|
||||
|
||||
return sites
|
||||
|
||||
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…
Reference in New Issue
Block a user