Skip to content
Permalink
Browse files

use QStringLiteral in Settings

Signed-off-by: Marco Bernasocchi <marco@opengis.ch>

remove unused mServerSettings

Signed-off-by: Marco Bernasocchi <marco@opengis.ch>

Fix typo and code style

Signed-off-by: Marco Bernasocchi <marco@opengis.ch>

Fix test

Fix test
  • Loading branch information
mbernasocchi committed Apr 3, 2019
1 parent 2cda2af commit 64e92c1f894efe197bddc4bfed910e9a92bb9b7a
@@ -33,8 +33,8 @@ void QgsServerSettings::initSettings()
// options path
const Setting sOptPath = { QgsServerSettingsEnv::QGIS_OPTIONS_PATH,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Override the default path for user configuration",
"",
QStringLiteral( "Override the default path for user configuration" ),
QString(),
QVariant::String,
QVariant( "" ),
QVariant()
@@ -44,8 +44,8 @@ void QgsServerSettings::initSettings()
// parallel rendering
const Setting sParRend = { QgsServerSettingsEnv::QGIS_SERVER_PARALLEL_RENDERING,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Activate/Deactivate parallel rendering for WMS getMap request",
"/qgis/parallel_rendering",
QStringLiteral( "Activate/Deactivate parallel rendering for WMS getMap request" ),
QStringLiteral( "/qgis/parallel_rendering" ),
QVariant::Bool,
QVariant( false ),
QVariant()
@@ -55,8 +55,8 @@ void QgsServerSettings::initSettings()
// max threads
const Setting sMaxThreads = { QgsServerSettingsEnv::QGIS_SERVER_MAX_THREADS,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Number of threads to use when parallel rendering is activated",
"/qgis/max_threads",
QStringLiteral( "Number of threads to use when parallel rendering is activated" ),
QStringLiteral( "/qgis/max_threads" ),
QVariant::Int,
QVariant( -1 ),
QVariant()
@@ -66,8 +66,8 @@ void QgsServerSettings::initSettings()
// log level
const Setting sLogLevel = { QgsServerSettingsEnv::QGIS_SERVER_LOG_LEVEL,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Log level",
"",
QStringLiteral( "Log level" ),
QString(),
QVariant::Int,
QVariant( Qgis::None ),
QVariant()
@@ -77,8 +77,8 @@ void QgsServerSettings::initSettings()
// log file
const Setting sLogFile = { QgsServerSettingsEnv::QGIS_SERVER_LOG_FILE,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Log file",
"",
QStringLiteral( "Log file" ),
QString(),
QVariant::String,
QVariant( "" ),
QVariant()
@@ -88,8 +88,8 @@ void QgsServerSettings::initSettings()
// log to stderr
const Setting sLogStderr = { QgsServerSettingsEnv::QGIS_SERVER_LOG_STDERR,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Activate/Deactivate logging to stderr",
"",
QStringLiteral( "Activate/Deactivate logging to stderr" ),
QString(),
QVariant::Bool,
QVariant( false ),
QVariant()
@@ -99,8 +99,8 @@ void QgsServerSettings::initSettings()
// project file
const Setting sProject = { QgsServerSettingsEnv::QGIS_PROJECT_FILE,
QgsServerSettingsEnv::DEFAULT_VALUE,
"QGIS project file",
"",
QStringLiteral( "QGIS project file" ),
QString(),
QVariant::String,
QVariant( "" ),
QVariant()
@@ -110,8 +110,8 @@ void QgsServerSettings::initSettings()
// max cache layers
const Setting sMaxCacheLayers = { QgsServerSettingsEnv::MAX_CACHE_LAYERS,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Specify the maximum number of cached layers",
"",
QStringLiteral( "Specify the maximum number of cached layers" ),
QString(),
QVariant::Int,
QVariant( 100 ),
QVariant()
@@ -121,8 +121,8 @@ void QgsServerSettings::initSettings()
// cache directory
const Setting sCacheDir = { QgsServerSettingsEnv::QGIS_SERVER_CACHE_DIRECTORY,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Specify the cache directory",
"/cache/directory",
QStringLiteral( "Specify the cache directory" ),
QStringLiteral( "/cache/directory" ),
QVariant::String,
QVariant( QgsApplication::qgisSettingsDirPath() + "cache" ),
QVariant()
@@ -132,8 +132,8 @@ void QgsServerSettings::initSettings()
// cache size
const Setting sCacheSize = { QgsServerSettingsEnv::QGIS_SERVER_CACHE_SIZE,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Specify the cache size",
"/cache/size",
QStringLiteral( "Specify the cache size" ),
QStringLiteral( "/cache/size" ),
QVariant::LongLong,
QVariant( 50 * 1024 * 1024 ),
QVariant()
@@ -165,8 +165,8 @@ void QgsServerSettings::initSettings()
// max height
const Setting sMaxHeight = { QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_HEIGHT,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Maximum height for a WMS request. The lower one of this and the project configuration is used.",
"/qgis/max_wms_height",
QStringLiteral( "Maximum height for a WMS request. The lower one of this and the project configuration is used." ),
QStringLiteral( "/qgis/max_wms_height" ),
QVariant::LongLong,
QVariant( -1 ),
QVariant()
@@ -176,8 +176,8 @@ void QgsServerSettings::initSettings()
// max width
const Setting sMaxWidth = { QgsServerSettingsEnv::QGIS_SERVER_WMS_MAX_WIDTH,
QgsServerSettingsEnv::DEFAULT_VALUE,
"Maximum width for a WMS request. The most conservative between this and the project one is used",
"/qgis/max_wms_width",
QStringLiteral( "Maximum width for a WMS request. The most conservative between this and the project one is used" ),
QStringLiteral( "/qgis/max_wms_width" ),
QVariant::LongLong,
QVariant( -1 ),
QVariant()
@@ -120,7 +120,6 @@ namespace QgsWms

mWmsParameters = mContext.parameters();
mWmsParameters.dump();
mServerSettings = mContext.settings();
}

QgsRenderer::~QgsRenderer()
@@ -619,9 +619,9 @@ def test_wms_getmap_invalid_size(self):
project = os.path.join(self.testdata_path, "test_project_with_size.qgs")
expected = self.strip_version_xmlns(b'<ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc">\n <ServiceException code="InvalidParameterValue">The requested map size is too large</ServiceException>\n</ServiceExceptionReport>\n')

os.environ['QGIS_SERVER_WMS_MAX_WIDTH'] = 6000
os.environ['QGIS_SERVER_WMS_MAX_HEIGHT'] = 6000
# test the 6000 limit from server is overriden by the more conservative 5000 in the project
os.environ['QGIS_SERVER_WMS_MAX_WIDTH'] = '6000'
os.environ['QGIS_SERVER_WMS_MAX_HEIGHT'] = '6000'
# test the 6000 limit from server is overridden by the more conservative 5000 in the project
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(project),
"SERVICE": "WMS",
@@ -637,8 +637,8 @@ def test_wms_getmap_invalid_size(self):
self.assertEqual(self.strip_version_xmlns(r), expected)

# test the QGIS_SERVER_WMS_MAX_XXX env vars
os.environ['QGIS_SERVER_WMS_MAX_WIDTH'] = 3000
os.environ['QGIS_SERVER_WMS_MAX_HEIGHT'] = 3000
os.environ['QGIS_SERVER_WMS_MAX_WIDTH'] = '3000'
os.environ['QGIS_SERVER_WMS_MAX_HEIGHT'] = '3000'
qs = "?" + "&".join(["%s=%s" % i for i in list({
"MAP": urllib.parse.quote(project),
"SERVICE": "WMS",

0 comments on commit 64e92c1

Please sign in to comment.
You can’t perform that action at this time.