Closed hayfield closed 6 years ago
Have marked as complete
to request a review. It may be highly desired that this functionality is extended to other decorators before merging, though have left as-is encase a better testing approach is thought of.
...it looks like the current implementation doesn't work when a function is decorated with multiple version decorators, for example in default.py
:
@iati.version.decimalise_integer
@iati.version.normalise_decimals
@iati.version.allow_known_version
def activity_schema(version, populate=True):
Thinking about this... the pre-3.5 methods of doing this (before the Signature
class was added) are all sub-optimal and make it challenging both to test and implement.
I'd suggest that the locations in resources
that would like to make use of this functionality instead utilise the private non-decorator implementation of these functions as an interim measure until it's decided how to progress in this area (version support, the scope of what this change to decorators should encompass, etc).
Due to the problems with the current implementation and limitations of pre-3.5 versions of Python, this PR will not be merged.
Once #300 and #301 are resolved, it may be desired to make another attempt at achieving this sort of capability, though this is a decision to be made down the line.
The flexibility of version standardisation decorators has been increased to allow the 'version' argument to be in positions other than first in decorated functions.
This is required for use in the resources module.
This sort of capability could also be extended to other decorators if desired.