def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=ogc_server_settings.public_url, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, DOCUMENTS_APP=settings.DOCUMENTS_APP, UPLOADER_URL=reverse('data_upload') if getattr(settings, 'UPLOADER', dict()).get('BACKEND', 'geonode.rest') == 'geonode.importer' else reverse('layer_upload'), GEOGIT_ENABLED=ogc_server_settings.GEOGIT_ENABLED, TIME_ENABLED=getattr(settings, 'UPLOADER', dict()).get('OPTIONS', dict()).get('TIME_ENABLED', False), DEBUG_STATIC=getattr(settings, "DEBUG_STATIC", False), MF_PRINT_ENABLED=ogc_server_settings.MAPFISH_PRINT_ENABLED, PRINTNG_ENABLED=ogc_server_settings.PRINTNG_ENABLED, GS_SECURITY_ENABLED=ogc_server_settings.GEONODE_SECURITY_ENABLED, PROXY_URL=getattr(settings, 'PROXY_URL', '/proxy/?url='), SOCIAL_BUTTONS=getattr(settings, 'SOCIAL_BUTTONS', True))
def ident_json(request): site_url = settings.SITEURL.rstrip('/') if settings.SITEURL.startswith( 'http') else settings.SITEURL json_data = {} json_data['siteurl'] = site_url json_data['name'] = settings.PYCSW['CONFIGURATION']['metadata:main'][ 'identification_title'] json_data['poc'] = { 'name': settings.PYCSW['CONFIGURATION']['metadata:main']['contact_name'], 'email': settings.PYCSW['CONFIGURATION']['metadata:main']['contact_email'], 'twitter': f'https://twitter.com/{settings.TWITTER_SITE}' } json_data['version'] = get_version() json_data['services'] = { 'csw': settings.CATALOGUE['default']['URL'], 'ows': settings.OGC_SERVER['default']['LOCATION'] } json_data['counts'] = facets({'request': request, 'facet_type': 'home'}) return HttpResponse(content=json.dumps(json_data), content_type='application/json')
def ident_json(request): if not request.user.is_authenticated(): return HttpResponseRedirect( reverse('account_login') + '?next=' + request.get_full_path()) json_data = {} json_data['siteurl'] = settings.SITEURL json_data['name'] = settings.PYCSW['CONFIGURATION']['metadata:main'][ 'identification_title'] json_data['poc'] = { 'name': settings.PYCSW['CONFIGURATION']['metadata:main']['contact_name'], 'email': settings.PYCSW['CONFIGURATION']['metadata:main']['contact_email'], 'twitter': 'https://twitter.com/%s' % settings.TWITTER_SITE } json_data['version'] = get_version() json_data['services'] = { 'csw': settings.CATALOGUE['default']['URL'], 'ows': settings.OGC_SERVER['default']['LOCATION'] } json_data['counts'] = facets({'request': request, 'facet_type': 'home'}) return HttpResponse(content=json.dumps(json_data), mimetype='application/json')
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, RESOURCE_PUBLISHING=settings.RESOURCE_PUBLISHING, THEME_ACCOUNT_CONTACT_EMAIL=settings.THEME_ACCOUNT_CONTACT_EMAIL, DEBUG_STATIC=getattr(settings, "DEBUG_STATIC", False), PROXY_URL=getattr(settings, 'PROXY_URL', '/proxy/?url='), SOCIAL_BUTTONS=getattr(settings, 'SOCIAL_BUTTONS', False), HAYSTACK_SEARCH=getattr(settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr(settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr(settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr(settings, 'CLIENT_RESULTS_LIMIT', 10), SRID_DETAIL=getattr(settings, 'SRID', dict()).get('DETAIL', 'never'), LICENSES_ENABLED=getattr(settings, 'LICENSES', dict()).get('ENABLED', False), LICENSES_DETAIL=getattr(settings, 'LICENSES', dict()).get('DETAIL', 'never'), LICENSES_METADATA=getattr(settings, 'LICENSES', dict()).get('METADATA', 'never'), USE_NOTIFICATIONS=('notification' in settings.INSTALLED_APPS), DEFAULT_ANONYMOUS_VIEW_PERMISSION=getattr( settings, 'DEFAULT_ANONYMOUS_VIEW_PERMISSION', False), DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=getattr( settings, 'DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION', False), ) return defaults
def ident_json(request): if not request.user.is_authenticated(): return HttpResponseRedirect( reverse('account_login') + '?next=' + request.get_full_path()) json_data = {} json_data['siteurl'] = settings.SITEURL json_data['name'] = settings.PYCSW['CONFIGURATION']['metadata:main']['identification_title'] json_data['poc'] = { 'name': settings.PYCSW['CONFIGURATION']['metadata:main']['contact_name'], 'email': settings.PYCSW['CONFIGURATION']['metadata:main']['contact_email'], 'twitter': 'https://twitter.com/%s' % settings.TWITTER_SITE } json_data['version'] = get_version() json_data['services'] = { 'csw': settings.CATALOGUE['default']['URL'], 'ows': settings.OGC_SERVER['default']['LOCATION'] } json_data['counts'] = facets({'request': request, 'facet_type': 'home'}) return HttpResponse(content=json.dumps(json_data), mimetype='application/json')
def package(options): """ Creates a tarball to use for building the system elsewhere """ import tarfile import geonode version = geonode.get_version() # Use GeoNode's version for the package name. pkgname = 'GeoNode-%s-all' % version # Create the output directory. out_pkg = path(pkgname) out_pkg_tar = path("%s.tar.gz" % pkgname) # Create a distribution in zip format for the geonode python package. dist_dir = path('dist') dist_dir.rmtree() sh('python setup.py sdist --formats=zip') with pushd('package'): # Delete old tar files in that directory for f in glob.glob('GeoNode*.tar.gz'): old_package = path(f) if old_package != out_pkg_tar: old_package.remove() if out_pkg_tar.exists(): info('There is already a package for version %s' % version) return # Clean anything that is in the oupout package tree. out_pkg.rmtree() out_pkg.makedirs() support_folder = path('support') install_file = path('install.sh') # And copy the default files from the package folder. justcopy(support_folder, out_pkg / 'support') justcopy(install_file, out_pkg) geonode_dist = path('..') / 'dist' / 'GeoNode-%s.zip' % version justcopy(geonode_dist, out_pkg) # Create a tar file with all files in the output package folder. tar = tarfile.open(out_pkg_tar, "w:gz") for file in out_pkg.walkfiles(): tar.add(file) # Add the README with the license and important links to documentation. tar.add('README', arcname=('%s/README.rst' % out_pkg)) tar.close() # Remove all the files in the temporary output package directory. out_pkg.rmtree() # Report the info about the new package. info("%s created" % out_pkg_tar.abspath())
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, RESOURCE_PUBLISHING=settings.RESOURCE_PUBLISHING, DEBUG_STATIC=getattr( settings, "DEBUG_STATIC", False), PROXY_URL=getattr( settings, 'PROXY_URL', '/proxy/?url='), SOCIAL_BUTTONS=getattr( settings, 'SOCIAL_BUTTONS', True), HAYSTACK_SEARCH=getattr( settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr( settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr( settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr( settings, 'CLIENT_RESULTS_LIMIT', 10), LICENSES_ENABLED=getattr( settings, 'LICENSES', dict()).get( 'ENABLED', False), LICENSES_DETAIL=getattr( settings, 'LICENSES', dict()).get( 'DETAIL', 'never'), LICENSES_METADATA=getattr( settings, 'LICENSES', dict()).get( 'METADATA', 'never'), ) return defaults
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, GROUPS_APP=True if "geonode.contrib.groups" in settings.INSTALLED_APPS else False, DEBUG_STATIC=getattr(settings, "DEBUG_STATIC", False), PROXY_URL=getattr(settings, 'PROXY_URL', '/proxy/?url='), SOCIAL_BUTTONS=getattr(settings, 'SOCIAL_BUTTONS', True), USE_DOCUMENTS='geonode.documents' in settings.INSTALLED_APPS, USE_SERVICES='geonode.contrib.services' in settings.INSTALLED_APPS, HAYSTACK_SEARCH=getattr(settings, 'HAYSTACK_SEARCH', False), CLIENT_RESULTS_LIMIT=getattr(settings, 'CLIENT_RESULTS_LIMIT', 10), LICENSES_ENABLED=getattr(settings, 'LICENSES', dict()).get('ENABLED', False), LICENSES_DETAIL=getattr(settings, 'LICENSES', dict()).get('DETAIL', 'never'), LICENSES_METADATA=getattr(settings, 'LICENSES', dict()).get('METADATA', 'never'), ) return defaults
def resource_urls(request): return dict( STATIC_URL=settings.STATIC_URL, GEONODE_CLIENT_LOCATION=settings.GEONODE_CLIENT_LOCATION, GEOSERVER_BASE_URL=settings.GEOSERVER_BASE_URL, GOOGLE_API_KEY=settings.GOOGLE_API_KEY, SITENAME=settings.SITENAME, REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), )
def resource_urls(request): return dict( STATIC_URL = settings.STATIC_URL, GEONODE_CLIENT_LOCATION = settings.GEONODE_CLIENT_LOCATION, GEOSERVER_BASE_URL = settings.GEOSERVER_BASE_URL, GOOGLE_API_KEY = settings.GOOGLE_API_KEY, SITENAME = settings.SITENAME, REGISTRATION_OPEN = settings.REGISTRATION_OPEN, VERSION = get_version(), )
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, SITEURL=settings.SITEURL, INSTALLED_APPS=settings.INSTALLED_APPS, RESOURCE_PUBLISHING=settings.RESOURCE_PUBLISHING, THEME_ACCOUNT_CONTACT_EMAIL=settings.THEME_ACCOUNT_CONTACT_EMAIL, DEBUG_STATIC=getattr(settings, "DEBUG_STATIC", False), PROXY_URL=getattr(settings, 'PROXY_URL', '/proxy/?url='), DISPLAY_SOCIAL=getattr(settings, 'DISPLAY_SOCIAL', False), DISPLAY_COMMENTS=getattr(settings, 'DISPLAY_COMMENTS', False), DISPLAY_RATINGS=getattr(settings, 'DISPLAY_RATINGS', False), TWITTER_CARD=getattr(settings, 'TWITTER_CARD', False), TWITTER_SITE=getattr(settings, 'TWITTER_SITE', '@GeoNode'), TWITTER_HASHTAGS=getattr(settings, 'TWITTER_HASHTAGS', []), OPENGRAPH_ENABLED=getattr(settings, 'OPENGRAPH_ENABLED', False), HAYSTACK_SEARCH=getattr(settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr(settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr(settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr(settings, 'CLIENT_RESULTS_LIMIT', 10), SRID_DETAIL=getattr(settings, 'SRID', dict()).get('DETAIL', 'never'), LICENSES_ENABLED=getattr(settings, 'LICENSES', dict()).get('ENABLED', False), LICENSES_DETAIL=getattr(settings, 'LICENSES', dict()).get('DETAIL', 'never'), LICENSES_METADATA=getattr(settings, 'LICENSES', dict()).get('METADATA', 'never'), USE_NOTIFICATIONS=has_notifications, DEFAULT_ANONYMOUS_VIEW_PERMISSION=getattr( settings, 'DEFAULT_ANONYMOUS_VIEW_PERMISSION', False), DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=getattr( settings, 'DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION', False), EXIF_ENABLED=getattr(settings, "EXIF_ENABLED", False), NLP_ENABLED=getattr(settings, "NLP_ENABLED", False), SEARCH_FILTERS=getattr(settings, 'SEARCH_FILTERS', False), THESAURI_FILTERS=[ t['name'] for t in settings.THESAURI if t.get('filter') ], ) defaults['message_create_url'] = 'message_create' if not settings.USER_MESSAGES_ALLOW_MULTIPLE_RECIPIENTS\ else 'message_create_multiple' return defaults
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=settings.GEOSERVER_BASE_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, DOCUMENTS_APP = settings.DOCUMENTS_APP, )
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=settings.GEOSERVER_BASE_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, DOCUMENTS_APP=settings.DOCUMENTS_APP, )
def resource_urls(request): return dict( STATIC_URL=settings.STATIC_URL, SITE_URL=settings.SITEURL, GEONODE_CLIENT_LOCATION=settings.GEONODE_CLIENT_LOCATION, GEOSERVER_BASE_URL=settings.GEOSERVER_BASE_URL, GOOGLE_API_KEY=settings.GOOGLE_API_KEY, GOOGLE_ANALYTICS_CODE=settings.GOOGLE_ANALYTICS_CODE, SITENAME=settings.SITENAME, REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), CUSTOM_GROUP_NAME=settings.CUSTOM_GROUP_NAME if settings.USE_CUSTOM_ORG_AUTHORIZATION else '', USE_CUSTOM_ORG_AUTHORIZATION=settings.USE_CUSTOM_ORG_AUTHORIZATION, USE_GAZETTEER=settings.USE_GAZETTEER)
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=settings.GEOSERVER_BASE_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, DOCUMENTS_APP = settings.DOCUMENTS_APP, UPLOADER_URL = reverse('data_upload') if (settings.UPLOADER_BACKEND_URL and settings.UPLOADER_BACKEND_URL == 'importer') else reverse('layer_upload') )
def resource_urls(request): return dict( STATIC_URL = settings.STATIC_URL, SITE_URL = settings.SITEURL, GEONODE_CLIENT_LOCATION = settings.GEONODE_CLIENT_LOCATION, GEOSERVER_BASE_URL = settings.GEOSERVER_BASE_URL, GOOGLE_API_KEY = settings.GOOGLE_API_KEY, GOOGLE_ANALYTICS_CODE = settings.GOOGLE_ANALYTICS_CODE, SITENAME = settings.SITENAME, REGISTRATION_OPEN = settings.REGISTRATION_OPEN, VERSION = get_version(), CUSTOM_GROUP_NAME = settings.CUSTOM_GROUP_NAME if settings.USE_CUSTOM_ORG_AUTHORIZATION else '', USE_CUSTOM_ORG_AUTHORIZATION = settings.USE_CUSTOM_ORG_AUTHORIZATION, USE_GAZETTEER = settings.USE_GAZETTEER )
def create_response( self, request, data, response_class=HttpResponse, response_objects=None, **response_kwargs): """ Extracts the common "which-format/serialize/return-response" cycle. Mostly a useful shortcut/hook. """ # If an user does not have at least view permissions, he won't be able # to see the resource at all. filtered_objects_ids = None try: if data['objects']: filtered_objects_ids = [ item.id for item in data['objects'] if request.user.has_perm( 'view_resourcebase', item.get_self_resource())] except BaseException: pass if isinstance( data, dict) and 'objects' in data and not isinstance( data['objects'], list): if filtered_objects_ids: data['objects'] = [ x for x in list( self.format_objects( data['objects'])) if x['id'] in filtered_objects_ids] else: data['objects'] = list(self.format_objects(data['objects'])) # give geonode version data['geonode_version'] = get_version() desired_format = self.determine_format(request) serialized = self.serialize(request, data, desired_format) return response_class( content=serialized, content_type=build_content_type(desired_format), **response_kwargs)
def create_response( self, request, data, response_class=HttpResponse, response_objects=None, **response_kwargs): """ Extracts the common "which-format/serialize/return-response" cycle. Mostly a useful shortcut/hook. """ # If an user does not have at least view permissions, he won't be able # to see the resource at all. filtered_objects_ids = None try: if data['objects']: filtered_objects_ids = [ item.id for item in data['objects'] if request.user.has_perm( 'view_resourcebase', item.get_self_resource())] except Exception: pass if isinstance( data, dict) and 'objects' in data and not isinstance( data['objects'], list): if filtered_objects_ids: data['objects'] = [ x for x in list( self.format_objects( data['objects'])) if x['id'] in filtered_objects_ids] else: data['objects'] = list(self.format_objects(data['objects'])) # give geonode version data['geonode_version'] = get_version() desired_format = self.determine_format(request) serialized = self.serialize(request, data, desired_format) return response_class( content=serialized, content_type=build_content_type(desired_format), **response_kwargs)
def versions(): import geonode from geonode.version import get_git_changeset raw_version = geonode.__version__ version = geonode.get_version() timestamp = get_git_changeset() major, minor, revision, stage, edition = raw_version branch = 'dev' if stage == 'alpha' and edition == 0: tail = '%s%s' % (branch, timestamp) else: tail = '%s%s' % (stage, edition) simple_version = '%s.%s.%s+%s' % (major, minor, revision, tail) return version, simple_version
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=settings.GEOSERVER_BASE_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, DOCUMENTS_APP = settings.DOCUMENTS_APP, UPLOADER_URL = reverse('data_upload') if (settings.UPLOADER_BACKEND_URL and settings.UPLOADER_BACKEND_URL == 'importer') else reverse('layer_upload'), GEOGIT_ENABLED = getattr(settings, "GEOGIT_DATASTORE", False), TIME_ENABLED = getattr(settings, "UPLOADER_SHOW_TIME_STEP", False), PRINTNG_ENABLED = getattr(settings, "PRINTNG_ENABLED", False), DEBUG_STATIC = getattr(settings, "DEBUG_STATIC", False) )
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=settings.OGC_SERVER['default']['LOCATION'], CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, DOCUMENTS_APP = settings.DOCUMENTS_APP, UPLOADER_URL = reverse('layer_upload'), GEOGIT_ENABLED = getattr(settings, "GEOGIT_DATASTORE", False), TIME_ENABLED = getattr(settings, "UPLOADER_SHOW_TIME_STEP", False), DEBUG_STATIC = getattr(settings, "DEBUG_STATIC", False), MF_PRINT_ENABLED = settings.OGC_SERVER['default']['OPTIONS'].get("MAPFISH_PRINT_ENABLED", False), PRINTNG_ENABLED = settings.OGC_SERVER['default']['OPTIONS'].get("PRINTNG_ENABLED", False), GS_SECURITY_ENABLED = settings.OGC_SERVER['default']['OPTIONS'].get("GEONODE_SECURITY_ENABLED", False) )
def versions(): import geonode from geonode.version import get_git_changeset raw_version = geonode.__version__ version = geonode.get_version() timestamp = get_git_changeset() major, minor, revision, stage, edition = raw_version branch = 'dev' if stage == 'final': stage = 'thefinal' if stage == 'unstable': tail = f'{branch}{timestamp}' else: tail = f'{stage}{edition}' simple_version = f'{major}.{minor}.{revision}+{tail}' return version, simple_version
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=ogc_server_settings.LOCATION, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, DOCUMENTS_APP = settings.DOCUMENTS_APP, UPLOADER_URL = reverse('data_upload') if getattr(settings, 'UPLOADER', dict()).get('BACKEND', 'geonode.rest') == 'geonode.importer' else reverse('layer_upload'), GEOGIT_ENABLED = ogc_server_settings.GEOGIT_ENABLED, TIME_ENABLED = getattr(settings, 'UPLOADER', dict()).get('OPTIONS', dict()).get('TIME_ENABLED', False), DEBUG_STATIC = getattr(settings, "DEBUG_STATIC", False), MF_PRINT_ENABLED = ogc_server_settings.MAPFISH_PRINT_ENABLED, PRINTNG_ENABLED = ogc_server_settings.PRINTNG_ENABLED, GS_SECURITY_ENABLED = ogc_server_settings.GEONODE_SECURITY_ENABLED )
def versions(): import geonode from geonode.version import get_git_changeset raw_version = geonode.__version__ version = geonode.get_version() timestamp = get_git_changeset() major, minor, revision, stage, edition = raw_version branch = "dev" if stage == "final": stage = "thefinal" if stage == "alpha" and edition == 0: tail = "%s%s" % (branch, timestamp) else: tail = "%s%s" % (stage, edition) simple_version = "%s.%s.%s+%s" % (major, minor, revision, tail) return version, simple_version
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=settings.OGC_SERVER['default']['LOCATION'], CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, DOCUMENTS_APP=settings.DOCUMENTS_APP, UPLOADER_URL=reverse('layer_upload'), GEOGIT_ENABLED=getattr(settings, "GEOGIT_DATASTORE", False), TIME_ENABLED=getattr(settings, "UPLOADER_SHOW_TIME_STEP", False), DEBUG_STATIC=getattr(settings, "DEBUG_STATIC", False), MF_PRINT_ENABLED=settings.OGC_SERVER['default']['OPTIONS'].get( "MAPFISH_PRINT_ENABLED", False), PRINTNG_ENABLED=settings.OGC_SERVER['default']['OPTIONS'].get( "PRINTNG_ENABLED", False), GS_SECURITY_ENABLED=settings.OGC_SERVER['default']['OPTIONS'].get( "GEONODE_SECURITY_ENABLED", False))
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, GROUPS_APP=True if "geonode.contrib.groups" in settings.INSTALLED_APPS else False, DEBUG_STATIC=getattr(settings, "DEBUG_STATIC", False), PROXY_URL=getattr(settings, 'PROXY_URL', '/proxy/?url='), SOCIAL_BUTTONS=getattr(settings, 'SOCIAL_BUTTONS', True), USE_DOCUMENTS='geonode.documents' in settings.INSTALLED_APPS, USE_SERVICES = 'geonode.contrib.services' in settings.INSTALLED_APPS, HAYSTACK_SEARCH=getattr(settings, 'HAYSTACK_SEARCH', False), CLIENT_RESULTS_LIMIT=getattr(settings, 'CLIENT_RESULTS_LIMIT', 10), LICENSES_ENABLED = getattr(settings, 'LICENSES', dict()).get('ENABLED', False), LICENSES_DETAIL = getattr(settings, 'LICENSES', dict()).get('DETAIL', 'never'), LICENSES_METADATA = getattr(settings, 'LICENSES', dict()).get('METADATA', 'never'), ) return defaults
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() return dict( STATIC_URL=settings.STATIC_URL, GEOSERVER_BASE_URL=ogc_server_settings.public_url, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, GROUPS_APP = True if "geonode.contrib.groups" in settings.INSTALLED_APPS else False, UPLOADER_URL = reverse('data_upload') if getattr(settings, 'UPLOADER', dict()).get('BACKEND', 'geonode.rest') == 'geonode.importer' else reverse('layer_upload'), GEOGIT_ENABLED = ogc_server_settings.GEOGIT_ENABLED, TIME_ENABLED = getattr(settings, 'UPLOADER', dict()).get('OPTIONS', dict()).get('TIME_ENABLED', False), DEBUG_STATIC = getattr(settings, "DEBUG_STATIC", False), MF_PRINT_ENABLED = ogc_server_settings.MAPFISH_PRINT_ENABLED, PRINTNG_ENABLED = ogc_server_settings.PRINTNG_ENABLED, GS_SECURITY_ENABLED = ogc_server_settings.GEONODE_SECURITY_ENABLED, PROXY_URL = getattr(settings, 'PROXY_URL', '/proxy/?url='), SOCIAL_BUTTONS = getattr(settings, 'SOCIAL_BUTTONS', True), USE_DOCUMENTS = 'geonode.documents' in settings.INSTALLED_APPS )
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], ACCOUNT_OPEN_SIGNUP=settings.ACCOUNT_OPEN_SIGNUP, ACCOUNT_APPROVAL_REQUIRED=settings.ACCOUNT_APPROVAL_REQUIRED, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, SITEURL=settings.SITEURL, INSTALLED_APPS=settings.INSTALLED_APPS, THEME_ACCOUNT_CONTACT_EMAIL=settings.THEME_ACCOUNT_CONTACT_EMAIL, DEBUG_STATIC=getattr( settings, "DEBUG_STATIC", False), PROXY_URL=getattr( settings, 'PROXY_URL', '/proxy/?url='), DISPLAY_SOCIAL=getattr( settings, 'DISPLAY_SOCIAL', False), DISPLAY_COMMENTS=getattr( settings, 'DISPLAY_COMMENTS', False), DISPLAY_RATINGS=getattr( settings, 'DISPLAY_RATINGS', False), DISPLAY_WMS_LINKS=getattr( settings, 'DISPLAY_WMS_LINKS', False), TWITTER_CARD=getattr( settings, 'TWITTER_CARD', False), TWITTER_SITE=getattr( settings, 'TWITTER_SITE', '@GeoNode'), TWITTER_HASHTAGS=getattr( settings, 'TWITTER_HASHTAGS', []), OPENGRAPH_ENABLED=getattr( settings, 'OPENGRAPH_ENABLED', False), ADMIN_MODERATE_UPLOADS=getattr( settings, 'ADMIN_MODERATE_UPLOADS', False), GROUP_MANDATORY_RESOURCES=getattr( settings, 'GROUP_MANDATORY_RESOURCES', False), GROUP_PRIVATE_RESOURCES=getattr( settings, 'GROUP_PRIVATE_RESOURCES', False), RESOURCE_PUBLISHING=getattr( settings, 'RESOURCE_PUBLISHING', False), HAYSTACK_SEARCH=getattr( settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr( settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr( settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr( settings, 'CLIENT_RESULTS_LIMIT', 10), API_LIMIT_PER_PAGE=getattr( settings, 'API_LIMIT_PER_PAGE', 20), SRID_DETAIL=getattr( settings, 'SRID', dict()).get( 'DETAIL', 'never'), LICENSES_ENABLED=getattr( settings, 'LICENSES', dict()).get( 'ENABLED', False), LICENSES_DETAIL=getattr( settings, 'LICENSES', dict()).get( 'DETAIL', 'never'), LICENSES_METADATA=getattr( settings, 'LICENSES', dict()).get( 'METADATA', 'never'), USE_GEOSERVER=settings.USE_GEOSERVER, USE_NOTIFICATIONS=has_notifications, USE_MONITORING='geonode.contrib.monitoring' in settings.INSTALLED_APPS and settings.MONITORING_ENABLED, USE_WORLDMAP=settings.USE_WORLDMAP, DEFAULT_ANONYMOUS_VIEW_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_VIEW_PERMISSION', False), DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION', False), EXIF_ENABLED=getattr( settings, "EXIF_ENABLED", False), NLP_ENABLED=getattr( settings, "NLP_ENABLED", False), SEARCH_FILTERS=getattr( settings, 'SEARCH_FILTERS', False ), THESAURI_FILTERS=[t['name'] for t in settings.THESAURI if t.get('filter')], #THESAURI_FILTERS=[t['name'] for t in [settings.THESAURI, ] if # t.get('filter')] if hasattr(settings, 'THESAURI') else None, MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS=getattr( settings, 'MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS', False ), SHOW_PROFILE_EMAIL=getattr( settings, "SHOW_PROFILE_EMAIL", False ), OGC_SERVER=getattr(settings, 'OGC_SERVER', None), ) if settings.USE_WORLDMAP: defaults['GEONODE_CLIENT_LOCATION'] = getattr( settings, 'GEONODE_CLIENT_LOCATION', '/static/worldmap/worldmap_client/' ) defaults['USE_HYPERMAP'] = getattr( settings, 'USE_HYPERMAP', False ) # TODO disable DB_DATASTORE setting defaults['DB_DATASTORE'] = True defaults['HYPERMAP_REGISTRY_URL'] = settings.HYPERMAP_REGISTRY_URL defaults['MAPPROXY_URL'] = settings.HYPERMAP_REGISTRY_URL defaults['SOLR_URL'] = settings.SOLR_URL defaults['USE_GAZETTEER'] = settings.USE_GAZETTEER defaults['GOOGLE_API_KEY'] = settings.GOOGLE_API_KEY defaults['GOOGLE_MAPS_API_KEY'] = settings.GOOGLE_MAPS_API_KEY defaults['WM_COPYRIGHT_URL'] = getattr( settings, 'WM_COPYRIGHT_URL', 'http://gis.harvard.edu/' ) defaults['WM_COPYRIGHT_TEXT'] = getattr( settings, 'WM_COPYRIGHT_TEXT', 'Center for Geographic Analysis' ) defaults['HYPERMAP_REGISTRY_URL'] = settings.HYPERMAP_REGISTRY_URL return defaults
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], ACCOUNT_OPEN_SIGNUP=settings.ACCOUNT_OPEN_SIGNUP, ACCOUNT_APPROVAL_REQUIRED=settings.ACCOUNT_APPROVAL_REQUIRED, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, SITEURL=settings.SITEURL, INSTALLED_APPS=settings.INSTALLED_APPS, THEME_ACCOUNT_CONTACT_EMAIL=settings.THEME_ACCOUNT_CONTACT_EMAIL, DEBUG_STATIC=getattr( settings, "DEBUG_STATIC", False), PROXY_URL=getattr( settings, 'PROXY_URL', '/proxy/?url='), DISPLAY_SOCIAL=getattr( settings, 'DISPLAY_SOCIAL', False), DISPLAY_COMMENTS=getattr( settings, 'DISPLAY_COMMENTS', False), DISPLAY_RATINGS=getattr( settings, 'DISPLAY_RATINGS', False), DISPLAY_WMS_LINKS=getattr( settings, 'DISPLAY_WMS_LINKS', False), TWITTER_CARD=getattr( settings, 'TWITTER_CARD', False), TWITTER_SITE=getattr( settings, 'TWITTER_SITE', '@GeoNode'), TWITTER_HASHTAGS=getattr( settings, 'TWITTER_HASHTAGS', []), OPENGRAPH_ENABLED=getattr( settings, 'OPENGRAPH_ENABLED', False), ADMIN_MODERATE_UPLOADS=getattr( settings, 'ADMIN_MODERATE_UPLOADS', False), GROUP_MANDATORY_RESOURCES=getattr( settings, 'GROUP_MANDATORY_RESOURCES', False), GROUP_PRIVATE_RESOURCES=getattr( settings, 'GROUP_PRIVATE_RESOURCES', False), RESOURCE_PUBLISHING=getattr( settings, 'RESOURCE_PUBLISHING', False), HAYSTACK_SEARCH=getattr( settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr( settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr( settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr( settings, 'CLIENT_RESULTS_LIMIT', 10), API_LIMIT_PER_PAGE=getattr( settings, 'API_LIMIT_PER_PAGE', 20), SRID_DETAIL=getattr( settings, 'SRID', dict()).get( 'DETAIL', 'never'), LICENSES_ENABLED=getattr( settings, 'LICENSES', dict()).get( 'ENABLED', False), LICENSES_DETAIL=getattr( settings, 'LICENSES', dict()).get( 'DETAIL', 'never'), LICENSES_METADATA=getattr( settings, 'LICENSES', dict()).get( 'METADATA', 'never'), USE_GEOSERVER=settings.USE_GEOSERVER, USE_NOTIFICATIONS=has_notifications, USE_MONITORING='geonode.contrib.monitoring' in settings.INSTALLED_APPS and settings.MONITORING_ENABLED, USE_WORLDMAP=settings.USE_WORLDMAP, DEFAULT_ANONYMOUS_VIEW_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_VIEW_PERMISSION', False), DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION', False), EXIF_ENABLED=getattr( settings, "EXIF_ENABLED", False), NLP_ENABLED=getattr( settings, "NLP_ENABLED", False), SEARCH_FILTERS=getattr( settings, 'SEARCH_FILTERS', False ), THESAURI_FILTERS=[t['name'] for t in settings.THESAURI if t.get('filter')], MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS=getattr( settings, 'MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS', False ), SHOW_PROFILE_EMAIL=getattr( settings, "SHOW_PROFILE_EMAIL", False ), OGC_SERVER=getattr(settings, 'OGC_SERVER', None), ) if settings.USE_WORLDMAP: defaults['GEONODE_CLIENT_LOCATION'] = getattr( settings, 'GEONODE_CLIENT_LOCATION', '/static/worldmap/worldmap_client/' ) defaults['USE_HYPERMAP'] = getattr( settings, 'USE_HYPERMAP', False ) # TODO disable DB_DATASTORE setting defaults['DB_DATASTORE'] = True defaults['HYPERMAP_REGISTRY_URL'] = settings.HYPERMAP_REGISTRY_URL defaults['MAPPROXY_URL'] = settings.HYPERMAP_REGISTRY_URL defaults['SOLR_URL'] = settings.SOLR_URL defaults['USE_GAZETTEER'] = settings.USE_GAZETTEER defaults['GOOGLE_API_KEY'] = settings.GOOGLE_API_KEY defaults['GOOGLE_MAPS_API_KEY'] = settings.GOOGLE_MAPS_API_KEY defaults['WM_COPYRIGHT_URL'] = getattr( settings, 'WM_COPYRIGHT_URL', 'http://gis.harvard.edu/' ) defaults['WM_COPYRIGHT_TEXT'] = getattr( settings, 'WM_COPYRIGHT_TEXT', 'Center for Geographic Analysis' ) defaults['HYPERMAP_REGISTRY_URL'] = settings.HYPERMAP_REGISTRY_URL return defaults
def test_theme_customization(self): # By default, the homepage should use default welcome text response = self.client.get('/') logger.error( "!! With the new geonode-mapstore-client landing page, this test must be changed." ) logger.error("WARNING: different for 3.2.x and 3.1.x") version = [int(_v) for _v in get_version()[:5].split(".")] if version[0] == 3 and (version[1] == 1 or (version[1] == 2 and version[2] <= 2)): self.assertContains( response, "GeoNode is an open source platform for sharing geospatial data and maps." ) # Creating a theme should change the welcome text GeoNodeThemeCustomization.objects.create( name='theme_1', jumbotron_welcome_content='welcome_1', is_enabled=True, ) response = self.client.get('/') self.assertNotContains( response, "GeoNode is an open source platform for sharing geospatial data and maps." ) self.assertContains(response, "welcome_1") # Creating another theme should replace the welcome text GeoNodeThemeCustomization.objects.create( name='theme_2', jumbotron_welcome_content='welcome_2', is_enabled=True, ) response = self.client.get('/') self.assertNotContains(response, "welcome_1") self.assertContains(response, "welcome_2") # Creating a disabled theme should not replace the welcome text theme_3 = GeoNodeThemeCustomization.objects.create( name='theme_3', jumbotron_welcome_content='welcome_3', is_enabled=False, ) response = self.client.get('/') self.assertNotContains(response, "welcome_3") self.assertContains(response, "welcome_2") # Playing a bit with colors theme_3.search_bg_color = "#000001" theme_3.search_title_color = "#000002" theme_3.search_link_color = "#000003" theme_3.footer_text_color = "#000004" theme_3.footer_href_color = "#000005" # Enabling that theme afterwards should replace the welcome text theme_3.is_enabled = True theme_3.save() response = self.client.get('/') self.assertNotContains(response, "welcome_2") self.assertContains(response, "welcome_3") self.assertContains(response, f"background: {theme_3.search_bg_color};") self.assertContains(response, f"color: {theme_3.search_title_color};") self.assertContains(response, f"color: {theme_3.search_link_color};") self.assertContains(response, f"color: {theme_3.footer_text_color};") self.assertContains(response, f"color: {theme_3.footer_href_color};") # We should have only one active theme active_themes = GeoNodeThemeCustomization.objects.filter( is_enabled=True) self.assertEqual(active_themes.count(), 1) # Deleting that theme should revert to default theme_3.delete() response = self.client.get('/') self.assertNotContains(response, "welcome_3") self.assertContains( response, "GeoNode is an open source platform for sharing geospatial data and maps." )
import re import sys from datetime import timedelta from distutils.util import strtobool import dj_database_url # # General Django development settings # from django.conf.global_settings import DATETIME_INPUT_FORMATS from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS from geonode import get_version from kombu import Queue # GeoNode Version VERSION = get_version() # Defines the directory that contains the settings file as the PROJECT_ROOT # It is used for relative settings elsewhere. PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) # Setting debug to true makes Django serve static media and # present pretty error pages. DEBUG = strtobool(os.getenv('DEBUG', 'True')) # Set to True to load non-minified versions of (static) client dependencies # Requires to set-up Node and tools that are required for static development # otherwise it will raise errors for the missing non-minified dependencies DEBUG_STATIC = strtobool(os.getenv('DEBUG_STATIC', 'False')) # Define email service on GeoNode
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], REGISTRATION_OPEN=settings.REGISTRATION_OPEN, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, RESOURCE_PUBLISHING=settings.RESOURCE_PUBLISHING, THEME_ACCOUNT_CONTACT_EMAIL=settings.THEME_ACCOUNT_CONTACT_EMAIL, DEBUG_STATIC=getattr( settings, "DEBUG_STATIC", False), PROXY_URL=getattr( settings, 'PROXY_URL', '/proxy/?url='), SOCIAL_BUTTONS=getattr( settings, 'SOCIAL_BUTTONS', False), TWITTER_CARD=getattr( settings, 'TWITTER_CARD', False), TWITTER_SITE=getattr( settings, 'TWITTER_SITE', '@GeoNode'), TWITTER_HASHTAGS=getattr( settings, 'TWITTER_HASHTAGS', []), OPENGRAPH_ENABLED=getattr( settings, 'OPENGRAPH_ENABLED', False), HAYSTACK_SEARCH=getattr( settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr( settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr( settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr( settings, 'CLIENT_RESULTS_LIMIT', 10), SRID_DETAIL=getattr( settings, 'SRID', dict()).get( 'DETAIL', 'never'), LICENSES_ENABLED=getattr( settings, 'LICENSES', dict()).get( 'ENABLED', False), LICENSES_DETAIL=getattr( settings, 'LICENSES', dict()).get( 'DETAIL', 'never'), LICENSES_METADATA=getattr( settings, 'LICENSES', dict()).get( 'METADATA', 'never'), USE_NOTIFICATIONS=('notification' in settings.INSTALLED_APPS), DEFAULT_ANONYMOUS_VIEW_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_VIEW_PERMISSION', False), DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION', False), SEARCH_FILTERS=getattr( settings, 'SEARCH_FILTERS', False ), ) return defaults
# along with this program. If not, see <http://www.gnu.org/licenses/>. # ######################################################################### # Django settings for the GeoNode project. import os from kombu import Queue import geonode from geonode.celery_app import app # flake8: noqa # # General Django development settings # # GeoNode Version VERSION = geonode.get_version() # Defines the directory that contains the settings file as the PROJECT_ROOT # It is used for relative settings elsewhere. PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) # Setting debug to true makes Django serve static media and # present pretty error pages. DEBUG = TEMPLATE_DEBUG = True # Set to True to load non-minified versions of (static) client dependencies # Requires to set-up Node and tools that are required for static development # otherwise it will raise errors for the missing non-minified dependencies DEBUG_STATIC = False # This is needed for integration tests, they require
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], ACCOUNT_OPEN_SIGNUP=settings.ACCOUNT_OPEN_SIGNUP, ACCOUNT_APPROVAL_REQUIRED=settings.ACCOUNT_APPROVAL_REQUIRED, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, SITEURL=settings.SITEURL, INSTALLED_APPS=settings.INSTALLED_APPS, THEME_ACCOUNT_CONTACT_EMAIL=settings.THEME_ACCOUNT_CONTACT_EMAIL, DEBUG_STATIC=getattr( settings, "DEBUG_STATIC", False), PROXY_URL=getattr( settings, 'PROXY_URL', '/proxy/?url='), DISPLAY_SOCIAL=getattr( settings, 'DISPLAY_SOCIAL', False), DISPLAY_COMMENTS=getattr( settings, 'DISPLAY_COMMENTS', False), DISPLAY_RATINGS=getattr( settings, 'DISPLAY_RATINGS', False), DISPLAY_WMS_LINKS=getattr( settings, 'DISPLAY_WMS_LINKS', False), TWITTER_CARD=getattr( settings, 'TWITTER_CARD', False), TWITTER_SITE=getattr( settings, 'TWITTER_SITE', '@GeoNode'), TWITTER_HASHTAGS=getattr( settings, 'TWITTER_HASHTAGS', []), OPENGRAPH_ENABLED=getattr( settings, 'OPENGRAPH_ENABLED', False), ADMIN_MODERATE_UPLOADS=getattr( settings, 'ADMIN_MODERATE_UPLOADS', False), GROUP_MANDATORY_RESOURCES=getattr( settings, 'GROUP_MANDATORY_RESOURCES', False), GROUP_PRIVATE_RESOURCES=getattr( settings, 'GROUP_PRIVATE_RESOURCES', False), RESOURCE_PUBLISHING=getattr( settings, 'RESOURCE_PUBLISHING', False), HAYSTACK_SEARCH=getattr( settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr( settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr( settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr( settings, 'CLIENT_RESULTS_LIMIT', 10), API_LIMIT_PER_PAGE=getattr( settings, 'API_LIMIT_PER_PAGE', 20), SRID_DETAIL=getattr( settings, 'SRID', dict()).get( 'DETAIL', 'never'), LICENSES_ENABLED=getattr( settings, 'LICENSES', dict()).get( 'ENABLED', False), LICENSES_DETAIL=getattr( settings, 'LICENSES', dict()).get( 'DETAIL', 'never'), LICENSES_METADATA=getattr( settings, 'LICENSES', dict()).get( 'METADATA', 'never'), USE_GEOSERVER=settings.USE_GEOSERVER, USE_NOTIFICATIONS=has_notifications, USE_MONITORING='geonode.contrib.monitoring' in settings.INSTALLED_APPS and settings.MONITORING_ENABLED, DEFAULT_ANONYMOUS_VIEW_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_VIEW_PERMISSION', False), DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION', False), EXIF_ENABLED=getattr( settings, "EXIF_ENABLED", False), NLP_ENABLED=getattr( settings, "NLP_ENABLED", False), SEARCH_FILTERS=getattr( settings, 'SEARCH_FILTERS', False ), THESAURI_FILTERS=[t['name'] for t in settings.THESAURI if t.get('filter')], MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS=getattr( settings, 'MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS', False ), SHOW_PROFILE_EMAIL=getattr( settings, "SHOW_PROFILE_EMAIL", False ), OGC_SERVER=getattr(settings, 'OGC_SERVER', None), ) return defaults
def deb(options): """ Creates debian packages. Example uses: paver deb paver deb -k 12345 paver deb -k 12345 -p geonode/testing """ key = options.get('key', None) ppa = options.get('ppa', None) import geonode from geonode.version import get_git_changeset raw_version = geonode.__version__ version = geonode.get_version() timestamp = get_git_changeset() major, minor, revision, stage, edition = raw_version branch = 'dev' if stage == 'alpha' and edition == 0: tail = '%s%s' % (branch, timestamp) else: tail = '%s%s' % (stage, edition) simple_version = '%s.%s.%s+%s' % (major, minor, revision, tail) info('Creating package for GeoNode version %s' % version) with pushd('package'): # Get rid of any uncommitted changes to debian/changelog info('Getting rid of any uncommitted changes in debian/changelog') sh('git checkout debian/changelog') # Workaround for git-dch bug # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=594580 path('.git').makedirs() # Install requirements #sh('sudo apt-get -y install debhelper devscripts git-buildpackage') sh(('git-dch --spawn-editor=snapshot --git-author --new-version=%s' ' --id-length=6 --ignore-branch --release' % ( simple_version))) ## Revert workaround for git-dhc bug path('.git').rmtree() if key is None and ppa is None: # A local installable package sh('debuild -uc -us -A') elif key is None and ppa is not None: # A sources package, signed by daemon sh('debuild -S') elif key is not None and ppa is None: # A signed installable package sh('debuild -k%s -A' % key) elif key is not None and ppa is not None: # A signed, source package sh('debuild -k%s -S' % key) if ppa is not None: sh('dput ppa:%s geonode_%s_source.changes' % (ppa, simple_version))
def package(options): """ Creates a tarball to use for building the system elsewhere """ import pkg_resources import tarfile import geonode version = geonode.get_version() # Use GeoNode's version for the package name. pkgname = "GeoNode-%s-all" % version # Create the output directory. out_pkg = path(pkgname) out_pkg_tar = path("%s.tar.gz" % pkgname) # Create a distribution in zip format for the geonode python package. dist_dir = path("dist") dist_dir.rmtree() sh("python setup.py sdist --formats=zip") with pushd("package"): # Delete old tar files in that directory for f in glob.glob("GeoNode*.tar.gz"): old_package = path(f) if old_package != out_pkg_tar: old_package.remove() if out_pkg_tar.exists(): info("There is already a package for version %s" % version) return # Clean anything that is in the oupout package tree. out_pkg.rmtree() out_pkg.makedirs() support_folder = path("support") install_file = path("install.sh") # And copy the default files from the package folder. justcopy(support_folder, out_pkg / "support") justcopy(install_file, out_pkg) geonode_dist = path("..") / "dist" / "GeoNode-%s.zip" % version justcopy(geonode_dist, out_pkg) rogue_dist = path("../..") / "dist" / "geoshape-0.1.zip" justcopy(rogue_dist, out_pkg) # Create a tar file with all files in the output package folder. tar = tarfile.open(out_pkg_tar, "w:gz") for file in out_pkg.walkfiles(): tar.add(file) # Add the README with the license and important links to documentation. tar.add("README", arcname=("%s/README.md" % out_pkg)) tar.close() # Remove all the files in the temporary output package directory. out_pkg.rmtree() # Report the info about the new package. info("%s created" % out_pkg_tar.abspath())
from kombu import Queue from geonode import __file__ as geonode_path from geonode import get_version from geonode.celery_app import app # flake8: noqa from distutils.util import strtobool import djcelery import dj_database_url # # General Django development settings # # GeoNode Version VERSION = get_version() # Defines the directory that contains the settings file as the PROJECT_ROOT # It is used for relative settings elsewhere. PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__)) # Setting debug to true makes Django serve static media and # present pretty error pages. DEBUG = strtobool(os.getenv('DEBUG', 'True')) # Set to True to load non-minified versions of (static) client dependencies # Requires to set-up Node and tools that are required for static development # otherwise it will raise errors for the missing non-minified dependencies DEBUG_STATIC = strtobool(os.getenv('DEBUG_STATIC', 'False')) #Define email service on GeoNode
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], ACCOUNT_OPEN_SIGNUP=settings.ACCOUNT_OPEN_SIGNUP, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, SITEURL=settings.SITEURL, INSTALLED_APPS=settings.INSTALLED_APPS, RESOURCE_PUBLISHING=settings.RESOURCE_PUBLISHING, THEME_ACCOUNT_CONTACT_EMAIL=settings.THEME_ACCOUNT_CONTACT_EMAIL, DEBUG_STATIC=getattr( settings, "DEBUG_STATIC", False), PROXY_URL=getattr( settings, 'PROXY_URL', '/proxy/?url='), DISPLAY_SOCIAL=getattr( settings, 'DISPLAY_SOCIAL', False), DISPLAY_COMMENTS=getattr( settings, 'DISPLAY_COMMENTS', False), DISPLAY_RATINGS=getattr( settings, 'DISPLAY_RATINGS', False), TWITTER_CARD=getattr( settings, 'TWITTER_CARD', False), TWITTER_SITE=getattr( settings, 'TWITTER_SITE', '@GeoNode'), TWITTER_HASHTAGS=getattr( settings, 'TWITTER_HASHTAGS', []), OPENGRAPH_ENABLED=getattr( settings, 'OPENGRAPH_ENABLED', False), ADMIN_MODERATE_UPLOADS=getattr( settings, 'ADMIN_MODERATE_UPLOADS', False), HAYSTACK_SEARCH=getattr( settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr( settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr( settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr( settings, 'CLIENT_RESULTS_LIMIT', 10), SRID_DETAIL=getattr( settings, 'SRID', dict()).get( 'DETAIL', 'never'), LICENSES_ENABLED=getattr( settings, 'LICENSES', dict()).get( 'ENABLED', False), LICENSES_DETAIL=getattr( settings, 'LICENSES', dict()).get( 'DETAIL', 'never'), LICENSES_METADATA=getattr( settings, 'LICENSES', dict()).get( 'METADATA', 'never'), USE_NOTIFICATIONS=has_notifications, USE_MONITORING='geonode.contrib.monitoring' in settings.INSTALLED_APPS and settings.MONITORING_ENABLED, DEFAULT_ANONYMOUS_VIEW_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_VIEW_PERMISSION', False), DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION', False), EXIF_ENABLED=getattr( settings, "EXIF_ENABLED", False), NLP_ENABLED=getattr( settings, "NLP_ENABLED", False), SEARCH_FILTERS=getattr( settings, 'SEARCH_FILTERS', False ), THESAURI_FILTERS=[t['name'] for t in settings.THESAURI if t.get('filter')], MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS=getattr( settings, 'MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS', False ), SHOW_PROFILE_EMAIL=getattr( settings, "SHOW_PROFILE_EMAIL", False ), OGC_SERVER=getattr(settings, 'OGC_SERVER', None), ) defaults['message_create_url'] = 'message_create' if not settings.USER_MESSAGES_ALLOW_MULTIPLE_RECIPIENTS\ else 'message_create_multiple' return defaults
def resource_urls(request): """Global values to pass to templates""" site = Site.objects.get_current() thesaurus = Thesaurus.objects.filter(facet=True).all() if hasattr(settings, 'THESAURUS'): warnings.warn( 'Thesaurus settings is going to be' 'deprecated in the future versions, please move the settings to ' 'the new configuration ', FutureWarning) defaults = dict( STATIC_URL=settings.STATIC_URL, CATALOGUE_BASE_URL=default_catalogue_backend()['URL'], ACCOUNT_OPEN_SIGNUP=settings.ACCOUNT_OPEN_SIGNUP, ACCOUNT_APPROVAL_REQUIRED=settings.ACCOUNT_APPROVAL_REQUIRED, VERSION=get_version(), SITE_NAME=site.name, SITE_DOMAIN=site.domain, SITEURL=settings.SITEURL, INSTALLED_APPS=settings.INSTALLED_APPS, THEME_ACCOUNT_CONTACT_EMAIL=settings.THEME_ACCOUNT_CONTACT_EMAIL, TINYMCE_DEFAULT_CONFIG=settings.TINYMCE_DEFAULT_CONFIG, DEBUG_STATIC=getattr( settings, "DEBUG_STATIC", False), PROXY_URL=getattr( settings, 'PROXY_URL', '/proxy/?url='), DISPLAY_SOCIAL=getattr( settings, 'DISPLAY_SOCIAL', False), DISPLAY_COMMENTS=getattr( settings, 'DISPLAY_COMMENTS', False), DISPLAY_RATINGS=getattr( settings, 'DISPLAY_RATINGS', False), DISPLAY_WMS_LINKS=getattr( settings, 'DISPLAY_WMS_LINKS', True), CREATE_LAYER=getattr( settings, 'CREATE_LAYER', True), TWITTER_CARD=getattr( settings, 'TWITTER_CARD', False), TWITTER_SITE=getattr( settings, 'TWITTER_SITE', '@GeoNode'), TWITTER_HASHTAGS=getattr( settings, 'TWITTER_HASHTAGS', []), OPENGRAPH_ENABLED=getattr( settings, 'OPENGRAPH_ENABLED', False), ADMIN_MODERATE_UPLOADS=getattr( settings, 'ADMIN_MODERATE_UPLOADS', False), TOPICCATEGORY_MANDATORY=getattr( settings, 'TOPICCATEGORY_MANDATORY', False), GROUP_MANDATORY_RESOURCES=getattr( settings, 'GROUP_MANDATORY_RESOURCES', False), GROUP_PRIVATE_RESOURCES=getattr( settings, 'GROUP_PRIVATE_RESOURCES', False), RESOURCE_PUBLISHING=getattr( settings, 'RESOURCE_PUBLISHING', False), HAYSTACK_SEARCH=getattr( settings, 'HAYSTACK_SEARCH', False), SKIP_PERMS_FILTER=getattr( settings, 'SKIP_PERMS_FILTER', False), HAYSTACK_FACET_COUNTS=getattr( settings, 'HAYSTACK_FACET_COUNTS', False), CLIENT_RESULTS_LIMIT=getattr( settings, 'CLIENT_RESULTS_LIMIT', 10), API_LIMIT_PER_PAGE=getattr( settings, 'API_LIMIT_PER_PAGE', 20), SRID_DETAIL=getattr( settings, 'SRID', dict()).get( 'DETAIL', 'never'), LICENSES_ENABLED=getattr( settings, 'LICENSES', dict()).get( 'ENABLED', False), LICENSES_DETAIL=getattr( settings, 'LICENSES', dict()).get( 'DETAIL', 'never'), LICENSES_METADATA=getattr( settings, 'LICENSES', dict()).get( 'METADATA', 'never'), USE_GEOSERVER=getattr(settings, 'USE_GEOSERVER', False), USE_NOTIFICATIONS=has_notifications, USE_MONITORING='geonode.monitoring' in settings.INSTALLED_APPS and settings.MONITORING_ENABLED, DEFAULT_ANONYMOUS_VIEW_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_VIEW_PERMISSION', False), DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION=getattr(settings, 'DEFAULT_ANONYMOUS_DOWNLOAD_PERMISSION', False), EXIF_ENABLED=getattr( settings, "EXIF_ENABLED", False), FAVORITE_ENABLED=getattr( settings, "FAVORITE_ENABLED", False), SEARCH_FILTERS=getattr( settings, 'SEARCH_FILTERS', False ), THESAURI_FILTERS=[t['name'] for t in [settings.THESAURUS, ] if t.get('filter')] if hasattr(settings, 'THESAURUS') else [t.identifier for t in thesaurus], MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS=getattr( settings, 'MAP_CLIENT_USE_CROSS_ORIGIN_CREDENTIALS', False ), SHOW_PROFILE_EMAIL=getattr( settings, "SHOW_PROFILE_EMAIL", False ), OGC_SERVER=getattr(settings, 'OGC_SERVER', None), DELAYED_SECURITY_SIGNALS=getattr(settings, 'DELAYED_SECURITY_SIGNALS', False), READ_ONLY_MODE=getattr(Configuration.load(), 'read_only', False), # GeoNode Apps GEONODE_APPS_ENABLE=getattr(settings, 'GEONODE_APPS_ENABLE', False), GEONODE_APPS_NAME=getattr(settings, 'GEONODE_APPS_NAME', 'Apps'), GEONODE_APPS_NAV_MENU_ENABLE=getattr(settings, 'GEONODE_APPS_NAV_MENU_ENABLE', False), CATALOG_METADATA_TEMPLATE=getattr(settings, "CATALOG_METADATA_TEMPLATE", "catalogue/full_metadata.xml"), UI_REQUIRED_FIELDS=getattr(settings, "UI_REQUIRED_FIELDS", []) ) return defaults