diff line 36: param should be "versioned_annotations" not "annotations"
diff line 122: you define stack = entry_tags.stack presumably to make less typing below but then forget to use stack
Perhaps you could tidy up the zope.security.management imports as a drive by in test_utils? The ones in test_declarations also need some lovin' if you are so inclined - there's unused ones as well as formatting issues.
The default_dictionary argument defaults to {} but this is mutable. This can lead to unintended side effects since default args are only evaluated once when the function is defined. It doesn't look like anything bad happens in this case but my preference is to use default_dictionary=dict() just to be safe and explicitly correct in all cases.
A question:
In normalize_for_versions(self, versions, ...), do the later, more recent versions appear towards the front of the versions list? Perhaps the docstring could mention this just to clarify since being unfamiliar with the implementation, it was unclear to me without trying to figure it out.
A suggestion:
In places, instead of using 2-tuple's, eg versioned_annotations parameter to export_as_webservice_entry(), you could consider using a namedtuple. This will make code like:
if entry_tags.stack[0][0] is None: entry_tags.stack[0] = (earliest_version, entry_tags.stack[0][1])
much easier to read, especially for people not previously 100% familiar with the code. It would become something like:
if entry_tags.stack[0].version is None: entry_tags.stack[0] = (earliest_version, entry_tags.stack[0].annotations)
Also the return value of generate_entry_interfaces. So
Hi Leonard,
This looks good to me. I have some small fixme's:
diff line 36: param should be "versioned_ annotations" not "annotations" management imports as a drive by in test_utils? The ones in test_declarations also need some lovin' if you are so inclined - there's unused ones as well as formatting issues.
diff line 122: you define stack = entry_tags.stack presumably to make less typing below but then forget to use stack
Perhaps you could tidy up the zope.security.
A concern/question:
>> def normalize_ for_versions( self, versions, default_ dictionary= {}, error_prefix=''):
The default_dictionary argument defaults to {} but this is mutable. This can lead to unintended side effects since default args are only evaluated once when the function is defined. It doesn't look like anything bad happens in this case but my preference is to use default_ dictionary= dict() just to be safe and explicitly correct in all cases.
A question:
In normalize_ for_versions( self, versions, ...), do the later, more recent versions appear towards the front of the versions list? Perhaps the docstring could mention this just to clarify since being unfamiliar with the implementation, it was unclear to me without trying to figure it out.
A suggestion:
In places, instead of using 2-tuple's, eg versioned_ annotations parameter to export_ as_webservice_ entry() , you could consider using a namedtuple. This will make code like:
if entry_tags. stack[0] [0] is None:
entry_ tags.stack[ 0] = (earliest_version, entry_tags. stack[0] [1])
much easier to read, especially for people not previously 100% familiar with the code. It would become something like:
if entry_tags. stack[0] .version is None:
entry_ tags.stack[ 0] = (earliest_version, entry_tags. stack[0] .annotations)
Also the return value of generate_ entry_interface s. So
interfaces = generate_ entry_interface s(...)
... interfaces[0][0]
... interfaces[0][1]
becomes
interfaces = generate_ entry_interface s(...) 0].version 0].interface
... interfaces[
... interfaces[