-
Notifications
You must be signed in to change notification settings - Fork 4
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
tests to reproduce #89 #90
Conversation
Signed-off-by: Paul Horton <paul.horton@owasp.org>
…es not conform to current formatter Signed-off-by: Paul Horton <paul.horton@owasp.org>
Signed-off-by: Paul Horton <paul.horton@owasp.org>
Signed-off-by: Paul Horton <paul.horton@owasp.org>
Signed-off-by: Paul Horton <paul.horton@owasp.org>
for p, pi in klass_properties.items(): | ||
if pi.xml_array_config: | ||
array_type, nested_name = pi.xml_array_config | ||
if nested_name == strip_default_namespace(child_e.tag): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The strip_default_namespace(child_e.tag)
is as constant as it gets through all these nested loops.
Better calculate the value upfront, instead of each time the loop is processed.
@@ -557,6 +557,14 @@ def strip_default_namespace(s: str) -> str: | |||
# Handle Sub-Elements | |||
for child_e in data: | |||
decoded_k = CurrentFormatter.formatter.decode(strip_default_namespace(child_e.tag)) | |||
|
|||
if decoded_k not in klass_properties: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
possible optimiztion:
why not build up a lookup table, similar to klass_properties
?
something that known these XML-serialization field names, and mapps them to the properties.
This might be better than looping through all these things and building a lookup in several looped iterations ....
the mapping would be built during register_xml_property_array_config()
calls...
and could be applies here like so:
decoded_k = klass_properties_childnames_map.get(decoded_k, decoded_k)
Fixes #89
Tests added to reproduce behaviour reported in #89 - now fail:
ValueError: stock_id is not a known Property for tests.model.Book