Skip to content

Commit

Permalink
Fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidWhittingham committed Jun 10, 2022
2 parents cdafce7 + 2677db2 commit 1cd0395
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 5 deletions.
4 changes: 1 addition & 3 deletions agsconfig/editing/edit_prop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
128 changes: 127 additions & 1 deletion agsconfig/services/feature_server_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
}
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down
21 changes: 20 additions & 1 deletion tests/feature_server_extension_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 1cd0395

Please sign in to comment.