-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from ExCiteS/mstevens-0.6.1
v0.6.1
- Loading branch information
Showing
13 changed files
with
475 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import commands | ||
import re | ||
|
||
from django.conf import settings | ||
|
||
from geokey.applications.models import Application | ||
|
||
from .sapelli_exceptions import SapelliException | ||
from .sapelli_loader import get_sapelli_dir_path, get_sapelli_jar_path | ||
|
||
MINIMAL_JAVA_VERSION = '1.7.0' | ||
|
||
def check_extension(): | ||
# Check if SAPELLI_CLIENT_ID value is set in settings.py: | ||
try: | ||
client_id = settings.SAPELLI_CLIENT_ID | ||
except AttributeError: | ||
raise SapelliException('no SAPELLI_CLIENT_ID value set in geokey settings.py.') | ||
# Check if an application is registered with this client_id: | ||
try: | ||
Application.objects.get(client_id=client_id, authorization_grant_type='password') | ||
except Application.DoesNotExist: | ||
raise SapelliException('geokey_sapelli is not registered as an application (with password authorisation) on the server.') | ||
# Check if java 1.7.0 or more recent is installed: | ||
try: | ||
status_output = commands.getstatusoutput('java -version') | ||
if(status_output[0] != 0): | ||
raise SapelliException('java not installed, please install JRE v7 or later.') | ||
java_version = re.match(r'java version "(?P<java_version>[0-9]+\.[0-9]+\.[0-9]+)_.*', status_output[1]).group('java_version') | ||
if(java_version < MINIMAL_JAVA_VERSION): | ||
raise SapelliException('installed version of java is too old (installed: %s, minimum required: %s).' % (java_version, MINIMAL_JAVA_VERSION)) | ||
except BaseException, e: | ||
raise SapelliException('could not run java command (%s).' % str(e)) | ||
# Check if there is a sapelli working directory: | ||
get_sapelli_dir_path() # raises SapelliException | ||
# Check if we have the sapelli JAR: | ||
get_sapelli_jar_path() # raises SapelliException |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
geokey_sapelli/migrations/0012_remove_sapelliitem_image.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def copy_image_to_lookup_field(apps, schema_editor): | ||
SapelliItem = apps.get_model('geokey_sapelli', 'SapelliItem') | ||
for si in SapelliItem.objects.all(): | ||
si.lookup_value.symbol = si.image | ||
si.lookup_value.save() | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('geokey_sapelli', '0011_dir_path_sap_path'), | ||
('categories', '0014_category_symbol_lookupvalue_symbol'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(copy_image_to_lookup_field), | ||
|
||
migrations.RemoveField( | ||
model_name='sapelliitem', | ||
name='image', | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('oauth2_provider', '0002_08_updates'), | ||
('geokey_sapelli', '0012_remove_sapelliitem_image'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='SAPDownloadQRLink', | ||
fields=[ | ||
('access_token', models.OneToOneField(primary_key=True, serialize=False, to='oauth2_provider.AccessToken')), | ||
('sapelli_project', models.ForeignKey(to='geokey_sapelli.SapelliProject')), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.