Skip to content

Commit b6a44fb

Browse files
committed
Merge branch 'release-0.12.0'
2 parents 10f345e + fc4a875 commit b6a44fb

File tree

5 files changed

+40
-31
lines changed

5 files changed

+40
-31
lines changed

kalite/distributed/management/commands/kaserve.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -70,30 +70,13 @@ class Command(BaseCommand):
7070
def setup_server_if_needed(self):
7171
"""Run the setup command, if necessary."""
7272

73-
# Now, validate the server.
74-
try:
75-
if Settings.get("private_key") and Device.objects.count():
76-
# The only success case
77-
pass
78-
79-
elif not Device.objects.count():
80-
# Nothing we can do to recover
81-
raise CommandError("You are screwed, buddy--you went through setup but you have no devices defined! Call for help!")
82-
83-
else:
84-
# Force hitting recovery code, by raising a generic error
85-
# that gets us to the "except" clause
86-
raise DatabaseError
87-
88-
except DatabaseError:
73+
try: # Ensure that the database has been synced and a Device has been created
74+
assert Settings.get("private_key") and Device.objects.count()
75+
except (DatabaseError, AssertionError): # Otherwise, run the setup command
8976
self.stdout.write("Setting up KA Lite; this may take a few minutes; please wait!\n")
90-
91-
call_command("setup", interactive=False) # show output to the user
92-
#out = call_command_with_output("setup", interactive=False)
93-
#if out[1] or out[2]:
94-
# # Failed; report and exit
95-
# self.stderr.write(out[1])
96-
# raise CommandError("Failed to setup/recover.")
77+
call_command("setup", interactive=False)
78+
# Double check that the setup process successfully created a Device
79+
assert Settings.get("private_key") and Device.objects.count(), "There was an error configuring the server. Please report the output of this command to Learning Equality."
9780

9881
def reinitialize_server(self):
9982
"""Reset the server state."""

kalite/distributed/management/commands/setup.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
from django.core.management.base import BaseCommand, CommandError
2727

2828
import kalite
29+
from fle_utils.config.models import Settings
2930
from fle_utils.general import get_host_name
3031
from fle_utils.internet import get_ip_addresses
3132
from fle_utils.platforms import is_windows, system_script_extension
3233
from kalite.version import VERSION
3334
from kalite.facility.models import Facility
3435
from securesync.management.commands.initdevice import load_data_for_offline_install, confirm_or_generate_zone, Command as InitCommand
35-
from securesync.models import Zone
36+
from securesync.models import Zone, Device
3637

3738

3839
def raw_input_yn(prompt):
@@ -204,7 +205,7 @@ def handle(self, *args, **options):
204205

205206
if not install_clean and not database_file and not kalite.is_installed():
206207
# Make sure that, for non-sqlite installs, the database exists.
207-
raise Exception("For databases not using SQLIte, you must set up your database before running setup.")
208+
raise Exception("For databases not using SQLite, you must set up your database before running setup.")
208209

209210
# Do all input at once, at the beginning
210211
if install_clean and options["interactive"]:
@@ -246,13 +247,21 @@ def handle(self, *args, **options):
246247
call_command("syncdb", interactive=False, verbosity=options.get("verbosity"))
247248
call_command("migrate", merge=True, verbosity=options.get("verbosity"))
248249

249-
# Install data
250-
if install_clean:
251-
# Create device, load on any zone data
250+
# Individually generate any prerequisite models/state that is missing
251+
if not Settings.get("private_key"):
252252
call_command("generatekeys", verbosity=options.get("verbosity"))
253+
if not Device.objects.count():
253254
call_command("initdevice", hostname, description, verbosity=options.get("verbosity"))
255+
if not Facility.objects.count():
254256
Facility.initialize_default_facility()
255257

258+
# Install data
259+
# if install_clean:
260+
# # Create device, load on any zone data
261+
# call_command("generatekeys", verbosity=options.get("verbosity"))
262+
# call_command("initdevice", hostname, description, verbosity=options.get("verbosity"))
263+
# Facility.initialize_default_facility()
264+
256265
#else:
257266
# Device exists; load data if required.
258267
#

kalite/distributed/templates/distributed/exercise.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ <h2>
145145
{% if forloop.first and video.availability.en.thumbnail %}
146146
<li>
147147
<div class="thumbnail">
148-
<a class="related-video" href="{{ video.path }}" title="{% trans video.title %}" target="_blank">
148+
<a class="related-video" href="{{ video.path }}" title="{% trans video.title %}">
149149
<div class="thumb">
150150
<img class="thumbimage" src="{{ video.availability.en.thumbnail }}"/>
151151
<div class="thumbnail_label" style="margin-top: 68px; ">
@@ -162,7 +162,7 @@ <h2>
162162

163163
{% else %}
164164
<li>
165-
<a class="related-video related-video-inline" href="{{ video.path }}" title="{% trans video.title %}" target="_blank">
165+
<a class="related-video related-video-inline" href="{{ video.path }}" title="{% trans video.title %}">
166166
<span class="video-title">
167167
<span class="progress-circle" data-video-id="{{ video.id }}"></span>
168168
{% trans video.title %}

kalite/distributed/templates/distributed/help_admin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ <h2>{% trans "(Online) Help Documents" %}</h2>
3737
<td class="desc"> {% trans "Contains the latest information about setting up and using KA Lite." %}</td>
3838
</tr>
3939
<tr class="client-online-only">
40-
<td class="link"><a href="http://{{central_server_host}}/faq" target="_blank">{% trans "FAQ" %}</a></td>
40+
<td class="link"><a href="https://learningequality.org/ka-lite/faq/" target="_blank">{% trans "FAQ" %}</a></td>
4141
<td class="desc">{% trans "Contains the latest FAQ for troubleshooting." %}</td>
4242
</tr>
4343

kalite/version.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,23 @@
33
VERSION = "0.12.0"
44
VERSION_INFO = {
55

6+
"0.12.4": {
7+
"release_date": "2014/08/07",
8+
"git_commit": "8c3c3",
9+
"new_features": {
10+
"all": [],
11+
"students": [],
12+
"coaches": [],
13+
"admins": [],
14+
},
15+
"bugs_fixed": {
16+
"all": ["Run setup when database is not initialized on startup"],
17+
"students": ["Stop opening new tabs when opening related videos from exercises"],
18+
"coaches": [],
19+
"admins": [],
20+
},
21+
},
22+
623
"0.12.3": {
724
"release_date": "2014/08/02",
825
"git_commit": "90f88",

0 commit comments

Comments
 (0)