diff --git a/agsconfig/editing/edit_prop.py b/agsconfig/editing/edit_prop.py index 5549dcf..aafaebe 100644 --- a/agsconfig/editing/edit_prop.py +++ b/agsconfig/editing/edit_prop.py @@ -36,9 +36,7 @@ def __get__(self, obj, type=None): # this is used to get the property metadata via the type, if needed return self - value = obj._editor.get_value(self.name_of(obj), self.meta, obj) - - return value + return obj._editor.get_value(self.name_of(obj), self.meta, obj) def __set__(self, obj, value): # perform any constraint checks that are specified before setting the value diff --git a/agsconfig/services/feature_server_extension.py b/agsconfig/services/feature_server_extension.py index 3db9258..351cb64 100644 --- a/agsconfig/services/feature_server_extension.py +++ b/agsconfig/services/feature_server_extension.py @@ -53,7 +53,7 @@ def __init__(self, editor): { #yapf:disable "path": lambda extension_name: - "./Configurations/SVCConfiguration/Definition/Extensions/SVCExtension[TypeName='{0}']/Props/PropertyArray/PropertySetProperty[Key='allowGeometryUpdates']/Value".format(extension_name) + "./Configurations/SVCConfiguration/Definition/Extensions/SVCExtension[TypeName='{}']/Props/PropertyArray/PropertySetProperty[Key='allowGeometryUpdates']/Value".format(extension_name) } #yapf:enable ] } @@ -152,6 +152,102 @@ def __init__(self, editor): } ) + allow_others_to_delete = EditorProperty( + { + "formats": { + "agsJson": { + "conversions": [{ + "id": "boolToString" + }], + "paths": [ + { #yapf:disable + "document": "main", + "path": + lambda extension_name: + "$.extensions[?(@.typeName = '{}')].properties.allowOthersToDelete".format(extension_name) + } #yapf:enable + ] + }, + "sddraft": { + "conversions": [{ + "id": "boolToString" + }], + "paths": [ + { #yapf:disable + "path": + lambda extension_name: + "./Configurations/SVCConfiguration/Definition/Extensions/SVCExtension[TypeName='{}']/Props/PropertyArray/PropertySetProperty[Key='allowOthersToDelete']/Value".format(extension_name) + } #yapf:enable + ] + } + } + } + ) + + allow_others_to_query = EditorProperty( + { + "formats": { + "agsJson": { + "conversions": [{ + "id": "boolToString" + }], + "paths": [ + { #yapf:disable + "document": "main", + "path": + lambda extension_name: + "$.extensions[?(@.typeName = '{}')].properties.allowOthersToQuery".format(extension_name) + } #yapf:enable + ] + }, + "sddraft": { + "conversions": [{ + "id": "boolToString" + }], + "paths": [ + { #yapf:disable + "path": + lambda extension_name: + "./Configurations/SVCConfiguration/Definition/Extensions/SVCExtension[TypeName='{}']/Props/PropertyArray/PropertySetProperty[Key='allowOthersToQuery']/Value".format(extension_name) + } #yapf:enable + ] + } + } + } + ) + + allow_others_to_update = EditorProperty( + { + "formats": { + "agsJson": { + "conversions": [{ + "id": "boolToString" + }], + "paths": [ + { #yapf:disable + "document": "main", + "path": + lambda extension_name: + "$.extensions[?(@.typeName = '{}')].properties.allowOthersToUpdate".format(extension_name) + } #yapf:enable + ] + }, + "sddraft": { + "conversions": [{ + "id": "boolToString" + }], + "paths": [ + { #yapf:disable + "path": + lambda extension_name: + "./Configurations/SVCConfiguration/Definition/Extensions/SVCExtension[TypeName='{}']/Props/PropertyArray/PropertySetProperty[Key='allowOthersToUpdate']/Value".format(extension_name) + } #yapf:enable + ] + } + } + } + ) + allow_true_curves_updates = EditorProperty( {#yapf:disable "formats": { @@ -295,6 +391,36 @@ def __init__(self, editor): }#yapf:enable ) + set_defaults_to_null_for_not_null_fields_in_templates = EditorProperty( + { + "constraints": { + "default": False + }, + "formats": { + "agsJson": { + "conversions": [{ + "id": "boolToString", + "allowNone": False, + "noneAsFalse": True + }], + "paths": [ + { #yapf:disable + "document": "main", + "path": lambda extension_name: + "$.extensions[?(@.typeName = '{}')].properties.setDefaultsToNullForNotNullFieldsInTemplates" + .format(extension_name), + "parent": { + "children": [{ + "key": "setDefaultsToNullForNotNullFieldsInTemplates" + }] + } + } #yapf:enable + ] + } + } + } + ) + z_default_value = EditorProperty( {#yapf:disable "formats": { diff --git a/tests/feature_server_extension_mixin.py b/tests/feature_server_extension_mixin.py index 8f87f4a..6f0a489 100644 --- a/tests/feature_server_extension_mixin.py +++ b/tests/feature_server_extension_mixin.py @@ -25,10 +25,14 @@ BASE_GETTER_TEST_CASES + [ ('allow_geometry_updates', True, None), + ('allow_others_to_delete', False, None), + ('allow_others_to_query', True, None), + ('allow_others_to_update', False, None), ('allow_true_curves_updates', False, None), ('enable_ownership_based_access_control', False, None), ('enable_z_defaults', False, None), ('realm', None, None), + ('set_defaults_to_null_for_not_null_fields_in_templates', False, None), ('z_default_value', 0, None) ] )#yapf:enable @@ -52,6 +56,18 @@ def test_feature_server_getters(service_config, attribute, expected_value, excep ] + [ ("allow_geometry_updates", trueish_value, trueish_expected, None) for (trueish_value, trueish_expected) in TRUEISH_TEST_PARAMS + ] + [ + ("allow_geometry_updates_without_m_values", trueish_value, trueish_expected, None) + for (trueish_value, trueish_expected) in TRUEISH_TEST_PARAMS + ] + [ + ("allow_others_to_delete", trueish_value, trueish_expected, None) + for (trueish_value, trueish_expected) in TRUEISH_TEST_PARAMS + ] + [ + ("allow_others_to_query", trueish_value, trueish_expected, None) + for (trueish_value, trueish_expected) in TRUEISH_TEST_PARAMS + ] + [ + ("allow_others_to_update", trueish_value, trueish_expected, None) + for (trueish_value, trueish_expected) in TRUEISH_TEST_PARAMS ] + [ ("allow_true_curves_updates", trueish_value, trueish_expected, None) for (trueish_value, trueish_expected) in TRUEISH_TEST_PARAMS @@ -61,7 +77,10 @@ def test_feature_server_getters(service_config, attribute, expected_value, excep ] + [ ("enable_z_defaults", trueish_value, trueish_expected, None) for (trueish_value, trueish_expected) in TRUEISH_TEST_PARAMS - ] + ] + [ + ("set_defaults_to_null_for_not_null_fields_in_templates", trueish_value, trueish_expected, None) + for (trueish_value, trueish_expected) in TRUEISH_TEST_PARAMS + ] )#yapf:enable def test_feature_server_setters(service_config, attribute, new_value, expected_value, exception): if exception is not None: