Remove a workaround which was used in the 2.0 and 2.1 Report

objects, to structure object_refs type requirements as an empty
blacklist, instead of a whitelist.  I think it was originally
necessary due to the older implementation of ReferenceProperty
which was in place at the time.  With the implementation change
to invert whitelists with generics to blacklists when
allow_custom=True, a "full" whitelist is internally converted to
an empty blacklist anyway, so it winds up being the same thing.
But I think the full whitelist looks better in the code, so I
prefer that to the empty blacklist.
pull/1/head
Michael Chisholm 2021-03-31 20:56:31 -04:00
parent 0ddf0d2ca8
commit e735b537c7
2 changed files with 2 additions and 2 deletions

View File

@ -240,7 +240,7 @@ class Report(_DomainObject):
('name', StringProperty(required=True)), ('name', StringProperty(required=True)),
('description', StringProperty()), ('description', StringProperty()),
('published', TimestampProperty(required=True)), ('published', TimestampProperty(required=True)),
('object_refs', ListProperty(ReferenceProperty(invalid_types=[], spec_version='2.0'), required=True)), ('object_refs', ListProperty(ReferenceProperty(valid_types=["SCO", "SDO", "SRO"], spec_version='2.0'), required=True)),
('revoked', BooleanProperty(default=lambda: False)), ('revoked', BooleanProperty(default=lambda: False)),
('labels', ListProperty(OpenVocabProperty(REPORT_LABEL), required=True)), ('labels', ListProperty(OpenVocabProperty(REPORT_LABEL), required=True)),
('external_references', ListProperty(ExternalReference)), ('external_references', ListProperty(ExternalReference)),

View File

@ -644,7 +644,7 @@ class Report(_DomainObject):
('description', StringProperty()), ('description', StringProperty()),
('report_types', ListProperty(OpenVocabProperty(REPORT_TYPE))), ('report_types', ListProperty(OpenVocabProperty(REPORT_TYPE))),
('published', TimestampProperty(required=True)), ('published', TimestampProperty(required=True)),
('object_refs', ListProperty(ReferenceProperty(invalid_types=[], spec_version='2.1'), required=True)), ('object_refs', ListProperty(ReferenceProperty(valid_types=["SCO", "SDO", "SRO"], spec_version='2.1'), required=True)),
('revoked', BooleanProperty(default=lambda: False)), ('revoked', BooleanProperty(default=lambda: False)),
('labels', ListProperty(StringProperty)), ('labels', ListProperty(StringProperty)),
('confidence', IntegerProperty()), ('confidence', IntegerProperty()),