Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #6596] Incorrect Legend displayed in the layer detail page #6597

Merged
merged 2 commits into from
Nov 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 33 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,39 @@
language: python
python:
- 3.7
- 3.8

git:
depth: 3

cache:
bundler: true
yarn: true
pip: true
directories:
- node_modules
- $HOME/buildout-cache

before_cache:
- rm -f $HOME/.cache/pip/log/debug.log

dist: bionic
dist: focal

services:
- docker
- postgresql

addons:
hosts:
- geonode
postgresql: 9.6
chrome: stable
firefox: "latest-esr"
postgresql: "12"
apt:
packages:
- postgresql-9.6-postgis-2.4
- postgresql-12
- postgresql-client-12
- postgresql-server-dev-12
- postgresql-12-postgis-3
- nginx
sources:
- sourceline: 'ppa:ubuntugis/ppa'
firefox: "latest-esr"

branches:
only:
Expand Down Expand Up @@ -76,10 +83,19 @@ jobs:
- GEOSERVER_SERVER_URL: http://localhost:8080/geoserver/
- GEOSERVER_SERVER_PORT: 8080
- ON_TRAVIS: 'True'
- TEST_RUNNER_KEEPDB: 'True'
- TEST_RUN_INTEGRATION: 'True'
- TEST_RUN_INTEGRATION_SERVER: 'True'
- TEST_RUN_INTEGRATION_UPLOAD: 'False'
- TEST_RUN_INTEGRATION_MONITORING: 'False'
- TEST_RUN_INTEGRATION_CSW: 'True'
- TEST_RUN_INTEGRATION_BDD: 'False'
- MONITORING_ENABLED: 'False'
- SESSION_EXPIRED_CONTROL_ENABLED: 'True'
- CELERY_ALWAYS_EAGER: 'True'
- DATABASE_URL: 'postgis://geonode:geonode@localhost:5432/upload_test'
- GEODATABASE_URL: 'postgis://geonode:geonode@localhost:5432/upload_test'
- DEFAULT_BACKEND_DATASTORE: 'datastore'

- stage: unit-tests
name: "QGis Server-backend Core Modules Smoke Tests"
Expand Down Expand Up @@ -139,8 +155,7 @@ jobs:
- TEST_RUN_INTEGRATION_MONITORING: 'False'
- TEST_RUN_INTEGRATION_CSW: 'False'
- TEST_RUN_INTEGRATION_BDD: 'False'
- MONITORING_ENABLED: 'True'
- USER_ANALYTICS_ENABLED: 'True'
- MONITORING_ENABLED: 'False'
- SESSION_EXPIRED_CONTROL_ENABLED: 'True'
- CELERY_ALWAYS_EAGER: 'True'

Expand Down Expand Up @@ -185,8 +200,7 @@ jobs:
- TEST_RUN_INTEGRATION_MONITORING: 'False'
- TEST_RUN_INTEGRATION_CSW: 'False'
- TEST_RUN_INTEGRATION_BDD: 'False'
- MONITORING_ENABLED: 'True'
- USER_ANALYTICS_ENABLED: 'True'
- MONITORING_ENABLED: 'False'
- SESSION_EXPIRED_CONTROL_ENABLED: 'True'
- CELERY_ALWAYS_EAGER: 'True'

Expand All @@ -208,8 +222,7 @@ jobs:
- TEST_RUN_INTEGRATION_MONITORING: 'False'
- TEST_RUN_INTEGRATION_CSW: 'False'
- TEST_RUN_INTEGRATION_BDD: 'False'
- MONITORING_ENABLED: 'True'
- USER_ANALYTICS_ENABLED: 'True'
- MONITORING_ENABLED: 'False'
- SESSION_EXPIRED_CONTROL_ENABLED: 'True'
- CELERY_ALWAYS_EAGER: 'True'
- DATABASE_URL: 'postgis://geonode:geonode@localhost:5432/upload_test'
Expand Down Expand Up @@ -272,6 +285,7 @@ jobs:
fast_finish: true

allow_failures:
- name: "Backend Integration Tests"
- name: "Selenium Tests Core"
- name: "Selenium Tests SPCGeoNode"

Expand All @@ -281,13 +295,14 @@ before_install:
export GEONODE_REPOSITORY=$(pwd);
GECKODRIVER_VERSION="v0.24.0";
else
sudo apt-get update
sudo /etc/init.d/postgresql stop
sudo /etc/init.d/postgresql start 9.6
sudo apt-get update;
mkdir -p $HOME/buildout-cache/{eggs,downloads};
scripts/misc/geoserver_server_setup.sh before_install;
scripts/misc/qgis_server_setup.sh before_install;
sudo apt-get autoremove sqlite3;
sudo sed -i 's/port = 5433/port = 5432/' /etc/postgresql/12/main/postgresql.conf;
sudo sed -i 's/peer/trust/' /etc/postgresql/12/main/pg_hba.conf;
sudo pg_ctlcluster 12 main restart;
fi
- python --version;

Expand All @@ -314,8 +329,7 @@ install:
export PATH=$PATH:$PWD/bin;
else
sudo apt -qq -y update;
sudo apt install -y libgdal20 gdal-bin gettext libxml2 libxml2-dev libxslt1-dev zlib1g-dev libjpeg-dev libpq-dev libgdal-dev;
sudo apt install -y sqlite3 spatialite-bin libsqlite3-mod-spatialite;
sudo apt install -y build-essential gdal-bin python3.8-dev python3.8-venv virtualenvwrapper libxml2 libxml2-dev gettext libxslt1-dev libjpeg-dev libpng-dev libpq-dev libgdal-dev software-properties-common build-essential git unzip gcc zlib1g-dev libgeos-dev libproj-dev sqlite3 spatialite-bin libsqlite3-mod-spatialite libsqlite3-dev;
sudo apt install -y openjdk-8-jre openjdk-8-jdk;
sudo update-java-alternatives --set java-1.8.0-openjdk-amd64;
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::");
Expand Down Expand Up @@ -375,7 +389,6 @@ after_script:

after_success:
- codecov
- bash <(curl -s https://codecov.io/bash) -t 2c0e7780-1640-45f0-93a3-e103b057d8c8

notifications:
email:
Expand Down
13 changes: 6 additions & 7 deletions geonode/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,17 @@ class ThesaurusKeywordResource(TypeFilteredResource):

def build_filters(self, filters={}, ignore_bad_filters=False):
"""adds filtering by current language"""

id = filters.pop('id', None)

orm_filters = super(ThesaurusKeywordResource, self).build_filters(filters)
_filters = filters.copy()
id = _filters.pop('id', None)
orm_filters = super(ThesaurusKeywordResource, self).build_filters(_filters)

if id is not None:
orm_filters['keyword__id'] = id

orm_filters['lang'] = filters['lang'] if 'lang' in filters else get_language()
orm_filters['lang'] = _filters['lang'] if 'lang' in _filters else get_language()

if 'thesaurus' in filters:
orm_filters['keyword__thesaurus__identifier'] = filters['thesaurus']
if 'thesaurus' in _filters:
orm_filters['keyword__thesaurus__identifier'] = _filters['thesaurus']

return orm_filters

Expand Down
38 changes: 20 additions & 18 deletions geonode/api/resourcebase_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@
from .authentication import OAuthAuthentication
from .authorization import GeoNodeAuthorization, GeonodeApiKeyAuthentication

from .api import (TagResource,
RegionResource,
OwnersResource,
ThesaurusKeywordResource,
TopicCategoryResource,
GroupResource,
FILTER_TYPES)
from .api import (
TagResource,
RegionResource,
OwnersResource,
ThesaurusKeywordResource,
TopicCategoryResource,
GroupResource,
FILTER_TYPES)
from .paginator import CrossSiteXHRPaginator

if settings.HAYSTACK_SEARCH:
Expand All @@ -82,17 +83,18 @@
class CommonMetaApi:
authorization = GeoNodeAuthorization()
allowed_methods = ['get']
filtering = {'title': ALL,
'keywords': ALL_WITH_RELATIONS,
'tkeywords': ALL_WITH_RELATIONS,
'regions': ALL_WITH_RELATIONS,
'category': ALL_WITH_RELATIONS,
'group': ALL_WITH_RELATIONS,
'owner': ALL_WITH_RELATIONS,
'date': ALL,
'purpose': ALL,
'abstract': ALL
}
filtering = {
'title': ALL,
'keywords': ALL_WITH_RELATIONS,
'tkeywords': ALL_WITH_RELATIONS,
'regions': ALL_WITH_RELATIONS,
'category': ALL_WITH_RELATIONS,
'group': ALL_WITH_RELATIONS,
'owner': ALL_WITH_RELATIONS,
'date': ALL,
'purpose': ALL,
'abstract': ALL
}
ordering = ['date', 'title', 'popular_count']
max_limit = None

Expand Down
10 changes: 3 additions & 7 deletions geonode/base/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@
add_url_params,
bbox_to_wkt)
from geonode.groups.models import GroupProfile
from geonode.security.models import PermissionLevelMixin
from geonode.security.utils import get_visible_resources
from geonode.security.models import PermissionLevelMixin

from geonode.notifications_helper import (
send_notification,
get_notification_recipients)
Expand Down Expand Up @@ -1889,15 +1890,10 @@ def resourcebase_post_save(instance, *args, **kwargs):
tb = traceback.format_exc()
if tb:
logger.debug(tb)

try:
finally:
# refresh catalogue metadata records
from geonode.catalogue.models import catalogue_post_save
catalogue_post_save(instance=instance, sender=instance.__class__)
except Exception:
tb = traceback.format_exc()
if tb:
logger.debug(tb)


def rating_post_save(instance, *args, **kwargs):
Expand Down
3 changes: 1 addition & 2 deletions geonode/base/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ def value_from_datadict(self, data, files, name):
"""

try:
value = super(TaggitSelect2, self).value_from_datadict(data, files, name)

value = super(TaggitSelect2Custom, self).value_from_datadict(data, files, name)
if value and ',' not in value:
value = '%s,' % value
return value
Expand Down
Loading