]> git.openstreetmap.org Git - osqa.git/commitdiff
creating the site key setting that wraps the OSQA installation key, also creating...
authorjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 19 Apr 2011 15:59:02 +0000 (15:59 +0000)
committerjordan <jordan@0cfe37f9-358a-4d5e-be75-b63607b5c754>
Tue, 19 Apr 2011 15:59:02 +0000 (15:59 +0000)
git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@991 0cfe37f9-358a-4d5e-be75-b63607b5c754

forum_modules/updater/base.py [new file with mode: 0644]
forum_modules/updater/settings.py [new file with mode: 0644]
forum_modules/updater/urls.py
forum_modules/updater/views.py

diff --git a/forum_modules/updater/base.py b/forum_modules/updater/base.py
new file mode 100644 (file)
index 0000000..74d37e5
--- /dev/null
@@ -0,0 +1,6 @@
+import string
+import random
+
+def generate_installation_key():
+    gen = lambda length: "".join( [random.choice(string.digits+string.letters) for i in xrange(length)])
+    return '%s-%s-%s-%s' % (gen(4), gen(4), gen(4), gen(4))
\ No newline at end of file
diff --git a/forum_modules/updater/settings.py b/forum_modules/updater/settings.py
new file mode 100644 (file)
index 0000000..3faa290
--- /dev/null
@@ -0,0 +1,18 @@
+from forum.settings.base import Setting, SettingSet
+from django.utils.translation import ugettext_lazy as _
+
+from base import generate_installation_key
+
+UPDATER_SET = SettingSet('updater', _('Updater Settings'), _("OSQA Update Checker Settings."), 100)
+
+CHECK_FOR_UPDATES = Setting('CHECK_FOR_UPDATES', True, UPDATER_SET, dict(
+label = "Check for updates",
+help_text = _("""
+Use the OSQA update server recieve notifications about the latest updates.
+"""),
+required=False))
+
+SITE_KEY = Setting('SITE_KEY', generate_installation_key())
+
+# Update server. Do not edit.
+UPDATE_SERVER_URL = 'http://192.168.0.102:8008'
\ No newline at end of file
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..300a589418cd63ae163d322d268be093c3107983 100644 (file)
@@ -0,0 +1,9 @@
+from django.conf.urls.defaults import *
+from django.views.generic.simple import direct_to_template
+from django.utils.translation import ugettext as _
+
+from views import updater_index
+
+urlpatterns = patterns('',
+    url(r'^%s%s$' % (_('admin/'), _('updater/')),  updater_index, name='updater_index'),
+)
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..33b13b23c06898441ad8d4779a4877ab93ef083c 100644 (file)
@@ -0,0 +1,6 @@
+from django.http import HttpResponse
+from base import generate_installation_key
+from settings import SITE_KEY
+
+def updater_index(request):
+    return HttpResponse(str(SITE_KEY))