[GeoNode-devel] DJango 1.7.11 & Backup-and-Restore

Alessio Fabiani alessio.fabiani at geo-solutions.it
Thu Feb 18 03:17:22 PST 2016


Dear all,
while trying to fix the issues with the GeoNode model when deserializing
the Layers from JSON fixtures, I spent a considerable time trying to
convert GeoNode to DJango 1.7.11.

The bad news are that upgrading GeoNode to DJango 1.7.11 does not fix the
problem, the good ones is that I can now provide a patch (the one attached
for 2.4.x) to upgrade GeoNode to DJango 1.7.11.

I'm going to attach the patch here if anyone would like to take a look or
test it.

If the community wants to do the update, I can open a pull request.

Best Regards,
Alessio Fabiani.

==
GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.
==

Ing. Alessio Fabiani
@alfa7691
Founder/Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272
mob:   +39 333 8128928

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.



The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility  for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

---------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geonode-devel/attachments/20160218/5f73bbb6/attachment-0001.html>
-------------- next part --------------
diff --git a/geonode/base/admin.py b/geonode/base/admin.py
index d9858dc..a3f6f38 100644
--- a/geonode/base/admin.py
+++ b/geonode/base/admin.py
@@ -110,4 +110,5 @@ admin.site.register(License, LicenseAdmin)
 
 
 class ResourceBaseAdminForm(autocomplete_light.ModelForm):
-    keywords = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False)
+    #keywords = TaggitField(widget=TaggitWidget('TagAutocomplete'), required=False)
+    keywords = TaggitField(widget=TaggitWidget(), required=False)
diff --git a/geonode/contrib/geosites/views.py b/geonode/contrib/geosites/views.py
index b76c7ed..b2678bf 100644
--- a/geonode/contrib/geosites/views.py
+++ b/geonode/contrib/geosites/views.py
@@ -98,14 +98,14 @@ def layer_acls(request):
                 }
                 return HttpResponse(
                     json.dumps(result),
-                    mimetype="application/json")
+                    content_type="application/json")
         except Exception:
             pass
 
         if acl_user is None:
             return HttpResponse(_("Bad HTTP Authorization Credentials."),
                                 status=401,
-                                mimetype="text/plain")
+                                content_type="text/plain")
 
     # Include permissions on the anonymous user
     # use of polymorphic selectors/functions to optimize performances
@@ -132,7 +132,7 @@ def layer_acls(request):
         result['fullname'] = acl_user.get_full_name()
         result['email'] = acl_user.email
 
-    return HttpResponse(json.dumps(result), mimetype="application/json")
+    return HttpResponse(json.dumps(result), content_type="application/json")
 
 
 def ajax_login(request):
@@ -140,7 +140,7 @@ def ajax_login(request):
         return HttpResponse(
             content="ajax login requires HTTP POST",
             status=405,
-            mimetype="text/plain"
+            content_type="text/plain"
         )
     form = AjaxLoginForm(data=request.POST)
     if form.is_valid():
@@ -150,14 +150,14 @@ def ajax_login(request):
             return HttpResponse(
                 content="bad credentials or disabled user",
                 status=400,
-                mimetype="text/plain"
+                content_type="text/plain"
             )
         user = authenticate(username=username, password=password)
         if user is None or not user.is_active:
             return HttpResponse(
                 content="bad credentials or disabled user",
                 status=400,
-                mimetype="text/plain"
+                content_type="text/plain"
             )
         else:
             login(request, user)
@@ -166,12 +166,12 @@ def ajax_login(request):
             return HttpResponse(
                 content="successful login",
                 status=200,
-                mimetype="text/plain"
+                content_type="text/plain"
             )
     else:
         return HttpResponse(
             "The form you submitted doesn't look like a username/password combo.",
-            mimetype="text/plain",
+            content_type="text/plain",
             status=400)
 
 
@@ -180,12 +180,12 @@ def ajax_lookup(request):
         return HttpResponse(
             content='ajax user lookup requires HTTP POST',
             status=405,
-            mimetype='text/plain'
+            content_type='text/plain'
         )
     elif 'query' not in request.POST:
         return HttpResponse(
             content='use a field named "query" to specify a prefix to filter usernames',
-            mimetype='text/plain')
+            content_type='text/plain')
     keyword = request.POST['query']
     users = get_user_model().objects.filter(id__in=users_for_site())
     users = users.filter(Q(username__istartswith=keyword) |
@@ -202,7 +202,7 @@ def ajax_lookup(request):
     json_dict['groups'] = [({'name': g.slug, 'title': g.title}) for g in groups]
     return HttpResponse(
         content=json.dumps(json_dict),
-        mimetype='text/plain'
+        content_type='text/plain'
     )
 
 
diff --git a/geonode/contrib/slack/utils.py b/geonode/contrib/slack/utils.py
index 613b9fa..3d6f1aa 100644
--- a/geonode/contrib/slack/utils.py
+++ b/geonode/contrib/slack/utils.py
@@ -28,7 +28,10 @@ from django.conf import settings
 from django.contrib.sites.models import Site
 from django.core.urlresolvers import reverse
 from django.http import HttpResponse
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from .enumerations import SLACK_MESSAGE_TEMPLATES
 
 from geonode.base.models import Link
diff --git a/geonode/documents/views.py b/geonode/documents/views.py
index b42dc56..f5eb6d5 100644
--- a/geonode/documents/views.py
+++ b/geonode/documents/views.py
@@ -72,7 +72,7 @@ def document_detail(request, docid):
     if document is None:
         return HttpResponse(
             'An unknown error has occured.',
-            mimetype="text/plain",
+            content_type="text/plain",
             status=401
         )
 
@@ -280,7 +280,7 @@ def document_metadata(
     if document is None:
         return HttpResponse(
             'An unknown error has occured.',
-            mimetype="text/plain",
+            content_type="text/plain",
             status=401
         )
 
@@ -446,6 +446,6 @@ def document_remove(request, docid, template='documents/document_remove.html'):
     except PermissionDenied:
         return HttpResponse(
             'You are not allowed to delete this document',
-            mimetype="text/plain",
+            content_type="text/plain",
             status=401
         )
diff --git a/geonode/geoserver/views.py b/geonode/geoserver/views.py
index 2f67425..93c92c1 100644
--- a/geonode/geoserver/views.py
+++ b/geonode/geoserver/views.py
@@ -256,10 +256,10 @@ def feature_edit_check(request, layername):
             'change_layer_data',
             obj=layer) and layer.storeType == 'dataStore' and feature_edit:
         return HttpResponse(
-            json.dumps({'authorized': True}), mimetype="application/json")
+            json.dumps({'authorized': True}), content_type="application/json")
     else:
         return HttpResponse(
-            json.dumps({'authorized': False}), mimetype="application/json")
+            json.dumps({'authorized': False}), content_type="application/json")
 
 
 def style_change_check(request, path):
@@ -308,7 +308,7 @@ def geoserver_rest_proxy(request, proxy_path, downstream_path):
     if not request.user.is_authenticated():
         return HttpResponse(
             "You must be logged in to access GeoServer",
-            mimetype="text/plain",
+            content_type="text/plain",
             status=401)
 
     def strip_prefix(path, prefix):
@@ -333,7 +333,7 @@ def geoserver_rest_proxy(request, proxy_path, downstream_path):
             if not style_change_check(request, downstream_path):
                 return HttpResponse(
                     _("You don't have permissions to change style for this layer"),
-                    mimetype="text/plain",
+                    content_type="text/plain",
                     status=401)
             if downstream_path == 'rest/styles':
                 style_update(request, url)
@@ -346,7 +346,7 @@ def geoserver_rest_proxy(request, proxy_path, downstream_path):
     return HttpResponse(
         content=content,
         status=response.status,
-        mimetype=response.get("content-type", "text/plain"))
+        content_type=response.get("content-type", "text/plain"))
 
 
 def layer_batch_download(request):
@@ -421,7 +421,7 @@ def resolve_user(request):
         else:
             return HttpResponse(_("Bad HTTP Authorization Credentials."),
                                 status=401,
-                                mimetype="text/plain")
+                                content_type="text/plain")
 
     if not any([user, geoserver, superuser]
                ) and not request.user.is_anonymous():
@@ -437,7 +437,7 @@ def resolve_user(request):
     if acl_user and acl_user.is_authenticated():
         resp['fullname'] = acl_user.get_full_name()
         resp['email'] = acl_user.email
-    return HttpResponse(json.dumps(resp), mimetype="application/json")
+    return HttpResponse(json.dumps(resp), content_type="application/json")
 
 
 def layer_acls(request):
@@ -469,14 +469,14 @@ def layer_acls(request):
                 }
                 return HttpResponse(
                     json.dumps(result),
-                    mimetype="application/json")
+                    content_type="application/json")
         except Exception:
             pass
 
         if acl_user is None:
             return HttpResponse(_("Bad HTTP Authorization Credentials."),
                                 status=401,
-                                mimetype="text/plain")
+                                content_type="text/plain")
 
     # Include permissions on the anonymous user
     # use of polymorphic selectors/functions to optimize performances
@@ -502,4 +502,4 @@ def layer_acls(request):
         result['fullname'] = acl_user.get_full_name()
         result['email'] = acl_user.email
 
-    return HttpResponse(json.dumps(result), mimetype="application/json")
+    return HttpResponse(json.dumps(result), content_type="application/json")
diff --git a/geonode/layers/forms.py b/geonode/layers/forms.py
index 64ca02d..90a9373 100644
--- a/geonode/layers/forms.py
+++ b/geonode/layers/forms.py
@@ -24,7 +24,10 @@ import zipfile
 import autocomplete_light
 
 from django import forms
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from geonode.layers.utils import unzip_file
 from geonode.layers.models import Layer, Attribute
 
diff --git a/geonode/layers/models.py b/geonode/layers/models.py
index 0fdb26c..3fb541e 100644
--- a/geonode/layers/models.py
+++ b/geonode/layers/models.py
@@ -93,7 +93,7 @@ class Layer(ResourceBase):
         related_name='layer_default_style',
         null=True,
         blank=True)
-    styles = models.ManyToManyField(Style, related_name='layer_styles')
+    styles = models.ManyToManyField(Style, related_name='LayerStyles')
 
     charset = models.CharField(max_length=255, default='UTF-8')
 
@@ -241,7 +241,7 @@ class Layer(ResourceBase):
         return self.__class__.__name__
 
 
-class Layer_Styles(models.Model):
+class LayerStyles(models.Model):
     layer = models.ForeignKey(Layer)
     style = models.ForeignKey(Style)
 
diff --git a/geonode/layers/views.py b/geonode/layers/views.py
index 5fc9762..0b24735 100644
--- a/geonode/layers/views.py
+++ b/geonode/layers/views.py
@@ -33,7 +33,10 @@ from django.shortcuts import render_to_response
 from django.conf import settings
 from django.template import RequestContext
 from django.utils.translation import ugettext as _
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from django.utils.html import escape
 from django.template.defaultfilters import slugify
 from django.forms.models import inlineformset_factory
@@ -202,7 +205,7 @@ def layer_upload(request, template='upload/layer_upload.html'):
             status_code = 400
         return HttpResponse(
             json.dumps(out),
-            mimetype='application/json',
+            content_type='application/json',
             status=status_code)
 
 
@@ -516,7 +519,7 @@ def layer_replace(request, layername, template='layers/layer_replace.html'):
             status_code = 400
         return HttpResponse(
             json.dumps(out),
-            mimetype='application/json',
+            content_type='application/json',
             status=status_code)
 
 
@@ -565,5 +568,5 @@ def layer_thumbnail(request, layername):
             return HttpResponse(
                 content='error saving thumbnail',
                 status=500,
-                mimetype='text/plain'
+                content_type='text/plain'
             )
diff --git a/geonode/maps/models.py b/geonode/maps/models.py
index 3ebb9f7..2a812d9 100644
--- a/geonode/maps/models.py
+++ b/geonode/maps/models.py
@@ -24,7 +24,10 @@ import uuid
 from django.conf import settings
 from django.db import models
 from django.db.models import signals
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from django.contrib.contenttypes.models import ContentType
 from django.utils.translation import ugettext_lazy as _
 from django.core.exceptions import ObjectDoesNotExist
@@ -385,7 +388,7 @@ class MapLayer(models.Model, GXPLayerBase):
         null=True,
         max_length=200,
         blank=True)
-    # The mimetype of the image format to use for tiles (image/png, image/jpeg,
+    # The content_type of the image format to use for tiles (image/png, image/jpeg,
     # image/gif...)
 
     name = models.CharField(_('name'), null=True, max_length=200)
diff --git a/geonode/maps/tests.py b/geonode/maps/tests.py
index d509ce8..3406d35 100644
--- a/geonode/maps/tests.py
+++ b/geonode/maps/tests.py
@@ -22,7 +22,10 @@ from lxml import etree
 
 from django.core.urlresolvers import reverse
 from django.test import TestCase
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from django.contrib.contenttypes.models import ContentType
 from agon_ratings.models import OverallRating
 from django.contrib.auth import get_user_model
diff --git a/geonode/maps/views.py b/geonode/maps/views.py
index 5e06c42..aaee7e4 100644
--- a/geonode/maps/views.py
+++ b/geonode/maps/views.py
@@ -30,7 +30,12 @@ from django.shortcuts import render_to_response, get_object_or_404
 from django.conf import settings
 from django.template import RequestContext
 from django.utils.translation import ugettext as _
-from django.utils import simplejson as json
+try:
+    # Django >= 1.7
+    import json
+except ImportError:
+    # Django <= 1.6 backwards compatibility
+    from django.utils import simplejson as json
 from django.utils.html import strip_tags
 from django.db.models import F
 from django.views.decorators.clickjacking import xframe_options_exempt
@@ -322,7 +327,7 @@ def map_view(request, mapid, snapshot=None, template='maps/map_view.html'):
 def map_view_js(request, mapid):
     map_obj = _resolve_map(request, mapid, 'base.view_resourcebase', _PERMISSION_MSG_VIEW)
     config = map_obj.viewer_json(request.user)
-    return HttpResponse(json.dumps(config), mimetype="application/javascript")
+    return HttpResponse(json.dumps(config), content_type="application/javascript")
 
 
 def map_json(request, mapid, snapshot=None):
@@ -334,7 +339,7 @@ def map_json(request, mapid, snapshot=None):
             return HttpResponse(
                 _PERMISSION_MSG_LOGIN,
                 status=401,
-                mimetype="text/plain"
+                content_type="text/plain"
             )
 
         map_obj = Map.objects.get(id=mapid)
@@ -342,7 +347,7 @@ def map_json(request, mapid, snapshot=None):
             return HttpResponse(
                 _PERMISSION_MSG_SAVE,
                 status=401,
-                mimetype="text/plain"
+                content_type="text/plain"
             )
         try:
             map_obj.update_from_viewer(request.body)
@@ -355,7 +360,7 @@ def map_json(request, mapid, snapshot=None):
         except ValueError as e:
             return HttpResponse(
                 "The server could not understand the request." + str(e),
-                mimetype="text/plain",
+                content_type="text/plain",
                 status=400
             )
 
@@ -407,7 +412,7 @@ def new_map_json(request):
         if not request.user.is_authenticated():
             return HttpResponse(
                 'You must be logged in to save new maps',
-                mimetype="text/plain",
+                content_type="text/plain",
                 status=401
             )
 
@@ -436,7 +441,7 @@ def new_map_json(request):
             return HttpResponse(
                 json.dumps({'id': map_obj.id}),
                 status=200,
-                mimetype='application/json'
+                content_type='application/json'
             )
     else:
         return HttpResponse(status=405)
@@ -673,7 +678,7 @@ def map_wmc(request, mapid, template="maps/wmc.xml"):
     return render_to_response(template, RequestContext(request, {
         'map': map_obj,
         'siteurl': settings.SITEURL,
-    }), mimetype='text/xml')
+    }), content_type='text/xml')
 
 
 def map_wms(request, mapid):
@@ -696,7 +701,7 @@ def map_wms(request, mapid):
             )
             return HttpResponse(
                 json.dumps(response),
-                mimetype="application/json")
+                content_type="application/json")
         except:
             return HttpResponseServerError()
 
@@ -705,7 +710,7 @@ def map_wms(request, mapid):
             layerGroupName=getattr(map_obj.layer_group, 'name', ''),
             ows=getattr(ogc_server_settings, 'ows', ''),
         )
-        return HttpResponse(json.dumps(response), mimetype="application/json")
+        return HttpResponse(json.dumps(response), content_type="application/json")
 
     return HttpResponseNotAllowed(['PUT', 'GET'])
 
@@ -716,7 +721,7 @@ def maplayer_attributes(request, layername):
     return HttpResponse(
         json.dumps(
             layer.attribute_config()),
-        mimetype="application/json")
+        content_type="application/json")
 
 
 def snapshot_config(snapshot, map_obj, user):
@@ -817,15 +822,15 @@ def snapshot_create(request):
             config=clean_config(conf),
             map=Map.objects.get(
                 id=config['id']))
-        return HttpResponse(num_encode(snapshot.id), mimetype="text/plain")
+        return HttpResponse(num_encode(snapshot.id), content_type="text/plain")
     else:
-        return HttpResponse("Invalid JSON", mimetype="text/plain", status=500)
+        return HttpResponse("Invalid JSON", content_type="text/plain", status=500)
 
 
 def ajax_snapshot_history(request, mapid):
     map_obj = _resolve_map(request, mapid, 'base.view_resourcebase', _PERMISSION_MSG_VIEW)
     history = [snapshot.json() for snapshot in map_obj.snapshots]
-    return HttpResponse(json.dumps(history), mimetype="text/plain")
+    return HttpResponse(json.dumps(history), content_type="text/plain")
 
 
 def ajax_url_lookup(request):
@@ -833,12 +838,12 @@ def ajax_url_lookup(request):
         return HttpResponse(
             content='ajax user lookup requires HTTP POST',
             status=405,
-            mimetype='text/plain'
+            content_type='text/plain'
         )
     elif 'query' not in request.POST:
         return HttpResponse(
             content='use a field named "query" to specify a prefix to filter urls',
-            mimetype='text/plain')
+            content_type='text/plain')
     if request.POST['query'] != '':
         maps = Map.objects.filter(urlsuffix__startswith=request.POST['query'])
         if request.POST['mapid'] != '':
@@ -854,7 +859,7 @@ def ajax_url_lookup(request):
         }
     return HttpResponse(
         content=json.dumps(json_dict),
-        mimetype='text/plain'
+        content_type='text/plain'
     )
 
 
@@ -874,5 +879,5 @@ def map_thumbnail(request, mapid):
             return HttpResponse(
                 content='error saving thumbnail',
                 status=500,
-                mimetype='text/plain'
+                content_type='text/plain'
             )
diff --git a/geonode/middleware.py b/geonode/middleware.py
index e802853..af901df 100644
--- a/geonode/middleware.py
+++ b/geonode/middleware.py
@@ -1,4 +1,7 @@
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from django.http import HttpResponse
 
 from geonode.geoserver.helpers import ogc_server_settings
diff --git a/geonode/security/views.py b/geonode/security/views.py
index 0592e59..2ea7e76 100644
--- a/geonode/security/views.py
+++ b/geonode/security/views.py
@@ -18,7 +18,10 @@
 #
 #########################################################################
 
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from django.core.exceptions import PermissionDenied
 from django.http import HttpResponse
 from django.views.decorators.http import require_POST
@@ -59,7 +62,7 @@ def resource_permissions(request, resource_id):
         return HttpResponse(
             'You are not allowed to change permissions for this resource',
             status=401,
-            mimetype='text/plain')
+            content_type='text/plain')
 
     if request.method == 'POST':
         permission_spec = json.loads(request.body)
@@ -68,7 +71,7 @@ def resource_permissions(request, resource_id):
         return HttpResponse(
             json.dumps({'success': True}),
             status=200,
-            mimetype='text/plain'
+            content_type='text/plain'
         )
 
     elif request.method == 'GET':
@@ -76,13 +79,13 @@ def resource_permissions(request, resource_id):
         return HttpResponse(
             json.dumps({'success': True, 'permissions': permission_spec}),
             status=200,
-            mimetype='text/plain'
+            content_type='text/plain'
         )
     else:
         return HttpResponse(
             'No methods other than get and post are allowed',
             status=401,
-            mimetype='text/plain')
+            content_type='text/plain')
 
 
 @require_POST
@@ -106,13 +109,13 @@ def set_bulk_permissions(request):
         return HttpResponse(
             json.dumps({'success': 'ok', 'not_changed': not_permitted}),
             status=200,
-            mimetype='text/plain'
+            content_type='text/plain'
         )
     else:
         return HttpResponse(
             json.dumps({'error': 'Wrong permissions specification'}),
             status=400,
-            mimetype='text/plain')
+            content_type='text/plain')
 
 
 @require_POST
@@ -130,9 +133,9 @@ def request_permissions(request):
         return HttpResponse(
             json.dumps({'success': 'ok', }),
             status=200,
-            mimetype='text/plain')
+            content_type='text/plain')
     except:
         return HttpResponse(
             json.dumps({'error': 'error delivering notification'}),
             status=400,
-            mimetype='text/plain')
+            content_type='text/plain')
diff --git a/geonode/services/views.py b/geonode/services/views.py
index 01a02a5..3299b31 100644
--- a/geonode/services/views.py
+++ b/geonode/services/views.py
@@ -34,7 +34,12 @@ from django.conf import settings
 from django.template import RequestContext, loader
 from django.template.defaultfilters import slugify
 from django.utils.translation import ugettext as _
-from django.utils import simplejson as json
+try:
+    # Django >= 1.7
+    import json
+except ImportError:
+    # Django <= 1.6 backwards compatibility
+    from django.utils import simplejson as json
 from django.shortcuts import get_object_or_404
 
 from owslib.wms import WebMapService
@@ -284,7 +289,7 @@ def _process_wms_service(url, name, type, username, password, wms=None, owner=No
                         'service_title': service.title
                         }]
         return HttpResponse(json.dumps(return_dict),
-                            mimetype='application/json',
+                            content_type='application/json',
                             status=200)
     except:
         pass
@@ -316,7 +321,7 @@ def _register_cascaded_service(url, type, name, username, password, wms=None, ow
         return_dict['service_id'] = service.pk
         return_dict['msg'] = "This is an existing Service"
         return HttpResponse(json.dumps(return_dict),
-                            mimetype='application/json',
+                            content_type='application/json',
                             status=200)
     except:
         # TODO: Handle this error properly
@@ -408,7 +413,7 @@ def _register_cascaded_service(url, type, name, username, password, wms=None, ow
         return HttpResponse(
             'Invalid Method / Type combo: ' +
             'Only Cascaded WMS, WFS and WCS supported',
-            mimetype="text/plain",
+            content_type="text/plain",
             status=400)
 
     message = "Service %s registered" % service.name
@@ -426,7 +431,7 @@ def _register_cascaded_service(url, type, name, username, password, wms=None, ow
     else:
         _register_cascaded_layers(service)
     return HttpResponse(json.dumps(return_dict),
-                        mimetype='application/json',
+                        content_type='application/json',
                         status=200)
 
 
@@ -502,7 +507,7 @@ def _register_cascaded_layers(service, owner=None):
         message = "%d Layers Registered" % count
         return_dict = {'status': 'ok', 'msg': message}
         return HttpResponse(json.dumps(return_dict),
-                            mimetype='application/json',
+                            content_type='application/json',
                             status=200)
     elif service.type == 'WCS':
         return HttpResponse('Not Implemented (Yet)', status=501)
@@ -527,7 +532,7 @@ def _register_indexed_service(type, url, name, username, password, verbosity=Fal
             return_dict['service_id'] = service.pk
             return_dict['msg'] = "This is an existing Service"
             return HttpResponse(json.dumps(return_dict),
-                                mimetype='application/json',
+                                content_type='application/json',
                                 status=200)
         except:
             pass
@@ -567,7 +572,7 @@ def _register_indexed_service(type, url, name, username, password, verbosity=Fal
                         'available_layers': available_resources
                         }]
         return HttpResponse(json.dumps(return_dict),
-                            mimetype='application/json',
+                            content_type='application/json',
                             status=200)
     elif type == 'WFS':
         return HttpResponse('Not Implemented (Yet)', status=501)
@@ -577,7 +582,7 @@ def _register_indexed_service(type, url, name, username, password, verbosity=Fal
         return HttpResponse(
             'Invalid Method / Type combo: ' +
             'Only Indexed WMS, WFS and WCS supported',
-            mimetype="text/plain",
+            content_type="text/plain",
             status=400)
 
 
@@ -620,7 +625,7 @@ def _register_indexed_layers(service, wms=None, verbosity=False):
                 message = "%d Incompatible projection - try setting the service as cascaded" % count
                 return_dict = {'status': 'ok', 'msg': message}
                 return HttpResponse(json.dumps(return_dict),
-                                    mimetype='application/json',
+                                    content_type='application/json',
                                     status=200)
 
             bbox = list(
@@ -665,7 +670,7 @@ def _register_indexed_layers(service, wms=None, verbosity=False):
         message = "%d Layers Registered" % count
         return_dict = {'status': 'ok', 'msg': message}
         return HttpResponse(json.dumps(return_dict),
-                            mimetype='application/json',
+                            content_type='application/json',
                             status=200)
     elif service.type == 'WFS':
         return HttpResponse('Not Implemented (Yet)', status=501)
@@ -689,7 +694,7 @@ def _register_harvested_service(url, name, username, password, csw=None, owner=N
             'msg': 'This is an existing Service'
         }]
         return HttpResponse(json.dumps(return_dict),
-                            mimetype='application/json',
+                            content_type='application/json',
                             status=200)
     except:
         pass
@@ -726,7 +731,7 @@ def _register_harvested_service(url, name, username, password, csw=None, owner=N
         _harvest_csw(service)
 
     return HttpResponse(json.dumps(return_dict),
-                        mimetype='application/json',
+                        content_type='application/json',
                         status=200)
 
 
@@ -818,7 +823,7 @@ def _register_arcgis_url(url, name, username, password, owner=None, parent=None)
             arcserver, name, services=[], owner=owner, parent=parent)
 
     return HttpResponse(json.dumps(return_json),
-                        mimetype='application/json',
+                        content_type='application/json',
                         status=200)
 
 
@@ -1012,7 +1017,7 @@ def _register_ogp_service(url, owner=None):
                     'service_title': service.title
                     }]
     return HttpResponse(json.dumps(return_dict),
-                        mimetype='application/json',
+                        content_type='application/json',
                         status=200)
 
 
@@ -1258,14 +1263,14 @@ def ajax_service_permissions(request, service_id):
         return HttpResponse(
             'You are not allowed to change permissions for this service',
             status=401,
-            mimetype='text/plain'
+            content_type='text/plain'
         )
 
     if not request.method == 'POST':
         return HttpResponse(
             'You must use POST for editing service permissions',
             status=405,
-            mimetype='text/plain'
+            content_type='text/plain'
         )
 
     spec = json.loads(request.body)
@@ -1274,7 +1279,7 @@ def ajax_service_permissions(request, service_id):
     return HttpResponse(
         "Permissions updated",
         status=200,
-        mimetype='text/plain')
+        content_type='text/plain')
 
 
 def create_arcgis_links(instance):
diff --git a/geonode/settings.py b/geonode/settings.py
index bbced0e..5b0fabe 100644
--- a/geonode/settings.py
+++ b/geonode/settings.py
@@ -254,7 +254,9 @@ GEONODE_CONTRIB_APPS = (
 # GEONODE_APPS = GEONODE_APPS + GEONODE_CONTRIB_APPS
 
 INSTALLED_APPS = (
-
+    
+    'modeltranslation',
+    
     # Boostrap admin theme
     # 'django_admin_bootstrapped.bootstrap3',
     # 'django_admin_bootstrapped',
@@ -283,7 +285,7 @@ INSTALLED_APPS = (
     # 'haystack',
     'autocomplete_light',
     'mptt',
-    'modeltranslation',
+    #'modeltranslation',
     'djcelery',
 
     # Theme
@@ -303,7 +305,8 @@ INSTALLED_APPS = (
     'tastypie',
     'polymorphic',
     'guardian',
-
+    'fixture_magic',
+    
 ) + GEONODE_APPS
 
 LOGGING = {
@@ -898,7 +901,8 @@ try:
     }
     MAP_BASELAYERS.append(BING_LAYER)
 except NameError:
-    print "Not enabling BingMaps base layer as a BING_API_KEY is not defined in local_settings.py file."
+    #print "Not enabling BingMaps base layer as a BING_API_KEY is not defined in local_settings.py file."
+    pass
 
 # Require users to authenticate before using Geonode
 if LOCKDOWN_GEONODE:
diff --git a/geonode/social/signals.py b/geonode/social/signals.py
index 3b3fa5c..d3082cf 100644
--- a/geonode/social/signals.py
+++ b/geonode/social/signals.py
@@ -29,7 +29,7 @@ from django.conf import settings
 from django.db.models import signals
 from django.utils.translation import ugettext as _
 
-from actstream.exceptions import ModelNotActionable
+#from actstream.exceptions import ModelNotActionable
 
 from geonode.layers.models import Layer
 from geonode.maps.models import Map
@@ -126,7 +126,8 @@ def activity_post_modify_object(sender, instance, created=None, **kwargs):
                           object_name=action.get('object_name'),
                           raw_action=raw_action,
                           )
-        except ModelNotActionable:
+        #except ModelNotActionable:
+        except:
             logger.debug('The activity received a non-actionable Model or None as the actor/action.')
 
 
diff --git a/geonode/upload/views.py b/geonode/upload/views.py
index 2240f79..52e03e5 100644
--- a/geonode/upload/views.py
+++ b/geonode/upload/views.py
@@ -111,10 +111,10 @@ class JSONResponse(HttpResponse):
     def __init__(self,
                  obj='',
                  json_opts={},
-                 mimetype="application/json", *args, **kwargs):
+                 content_type="application/json", *args, **kwargs):
 
         content = json.dumps(obj, **json_opts)
-        super(JSONResponse, self).__init__(content, mimetype, *args, **kwargs)
+        super(JSONResponse, self).__init__(content, content_type, *args, **kwargs)
 
 
 def _error_response(req, exception=None, errors=None, force_ajax=True):
diff --git a/geonode/utils.py b/geonode/utils.py
index d84b933..8e67de2 100644
--- a/geonode/utils.py
+++ b/geonode/utils.py
@@ -32,7 +32,10 @@ from django.conf import settings
 from django.core.exceptions import PermissionDenied
 from django.utils.translation import ugettext_lazy as _
 from django.shortcuts import get_object_or_404
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from django.http import HttpResponse
 from django.core.cache import cache
 from django.http import Http404
diff --git a/geonode/views.py b/geonode/views.py
index 015b084..cad7644 100644
--- a/geonode/views.py
+++ b/geonode/views.py
@@ -21,7 +21,10 @@ from django import forms
 from django.contrib.auth import authenticate, login, get_user_model
 from django.http import HttpResponse, HttpResponseRedirect
 from django.core.urlresolvers import reverse
-from django.utils import simplejson as json
+try:
+    import json
+except ImportError:
+    from django.utils import simplejson as json
 from django.db.models import Q
 from django.template.response import TemplateResponse
 
@@ -38,7 +41,7 @@ def ajax_login(request):
         return HttpResponse(
             content="ajax login requires HTTP POST",
             status=405,
-            mimetype="text/plain"
+            content_type="text/plain"
         )
     form = AjaxLoginForm(data=request.POST)
     if form.is_valid():
@@ -49,7 +52,7 @@ def ajax_login(request):
             return HttpResponse(
                 content="bad credentials or disabled user",
                 status=400,
-                mimetype="text/plain"
+                content_type="text/plain"
             )
         else:
             login(request, user)
@@ -58,12 +61,12 @@ def ajax_login(request):
             return HttpResponse(
                 content="successful login",
                 status=200,
-                mimetype="text/plain"
+                content_type="text/plain"
             )
     else:
         return HttpResponse(
             "The form you submitted doesn't look like a username/password combo.",
-            mimetype="text/plain",
+            content_type="text/plain",
             status=400)
 
 
@@ -72,12 +75,12 @@ def ajax_lookup(request):
         return HttpResponse(
             content='ajax user lookup requires HTTP POST',
             status=405,
-            mimetype='text/plain'
+            content_type='text/plain'
         )
     elif 'query' not in request.POST:
         return HttpResponse(
             content='use a field named "query" to specify a prefix to filter usernames',
-            mimetype='text/plain')
+            content_type='text/plain')
     keyword = request.POST['query']
     users = get_user_model().objects.filter(Q(username__istartswith=keyword) |
                                             Q(first_name__icontains=keyword) |
@@ -92,7 +95,7 @@ def ajax_lookup(request):
     json_dict['groups'] = [({'name': g.slug, 'title': g.title}) for g in groups]
     return HttpResponse(
         content=json.dumps(json_dict),
-        mimetype='text/plain'
+        content_type='text/plain'
     )
 
 
diff --git a/setup.py b/setup.py
index a1a4694..16ef1b9 100644
--- a/setup.py
+++ b/setup.py
@@ -82,12 +82,12 @@ setup(name='GeoNode',
         "pillow", # python-pillow
         "lxml", # python-lxml
         # "psycopg2==2.4.5", # python-psycopg2
-        "Django==1.6.11", # python-django
+        "Django==1.7.11", # python-django
 
         # Other
         "beautifulsoup4==4.2.1", # python-bs4
         "MultipartPostHandler==0.1.0", # python-multipartposthandler
-        "httplib2==0.8", # python-httplib2
+        "httplib2==0.9.2", # python-httplib2
         "transifex-client==0.10", # transifex-client
         "Paver==1.2.1", # python-paver
         "nose <=1.0, <=1.3.1", # python-nose
@@ -98,9 +98,9 @@ setup(name='GeoNode',
         "django-pagination >=1.0.5, <=1.0.7", # python-django-pagination
         "django-jsonfield==0.9.12", # python-django-jsonfield
         "django-extensions==1.2.5", # python-django-extensions
-        "django-taggit==0.12", # python-django-taggit
-        "django-mptt==0.6.1", # django-mptt
-        "django-guardian==1.2.0", #django-guardian
+        "django-taggit==0.18.0", # python-django-taggit
+        "django-mptt==0.7.4", # django-mptt
+        "django-guardian==1.4.1", #django-guardian
         # "django-admin-bootstrapped==1.6.5", #django-admin-bootstrapped
 
         ## Apps with packages provided in GeoNode's PPA on Launchpad.
@@ -108,13 +108,13 @@ setup(name='GeoNode',
         "pinax-theme-bootstrap-account==1.0b2",
         "django-forms-bootstrap==3.0.1",
         "django-friendly-tag-loader==1.1",
-        "django-activity-stream==0.4.5beta1",
+        "django-activity-stream==0.6.0",
         "django-downloadview==1.2",
-        "django-tastypie==0.11.0",
+        "django-tastypie==0.13.3",
         "django-polymorphic==0.5.6",
         "django-leaflet==0.13.7",
-        "django-autocomplete-light==2.2.10",
-        "django-modeltranslation==0.8",
+        "django-autocomplete-light==2.3.3",
+        "django-modeltranslation==0.11",
 
         # GeoNode org maintained apps.
         "django-geoexplorer==4.0.5",
@@ -126,9 +126,10 @@ setup(name='GeoNode',
         "geonode-arcrest==10.2",
         "geonode-notification==1.1.1",
         "geonode-dialogos==0.4",
-        "gsconfig==1.0.3",
+        "gsconfig>=1.0.3",
         "gsimporter==1.0.0",
-        "gisdata==0.5.4",
+        "gisdata>=0.5.4",
+        "shapely>=1.5.13",
 
         # geopython dependencies
         "OWSLib==0.10.0",


More information about the geonode-devel mailing list