Skip to content

Commit b572e29

Browse files
authored
Merge pull request #138 from lsetiawan/fix_getcv
Missed builtin, should be last one
2 parents 65da961 + 9ca7459 commit b572e29

File tree

1 file changed

+34
-29
lines changed

1 file changed

+34
-29
lines changed

odm2api/ODM2/services/readService.py

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -229,66 +229,71 @@ def getAnnotations(self, annottype=None, codes=None, ids=None, **kwargs):
229229
return None
230230

231231
# CV
232-
def getCVs(self, type):
232+
def getCVs(self, cvtype, **kwargs):
233233
"""
234234
getCVs(self, type):
235235
* Pass CVType - return a list of all objects of the given type
236236
237237
"""
238-
CV = CVActionType
239-
if type == 'actiontype':
238+
self._check_kwargs(['type'], kwargs)
239+
if 'type' in kwargs:
240+
warnings.warn('The parameter \'type\' is deprecated. Please use the cvtype parameter instead.',
241+
DeprecationWarning, stacklevel=2)
242+
cvtype = kwargs['type']
243+
244+
if cvtype == 'actiontype':
240245
CV = CVActionType
241-
elif type == 'aggregationstatistic':
246+
elif cvtype == 'aggregationstatistic':
242247
CV = CVAggregationStatistic
243-
elif type == 'annotationtype':
248+
elif cvtype == 'annotationtype':
244249
CV = CVAnnotationType
245-
elif type == 'censorcode':
250+
elif cvtype == 'censorcode':
246251
CV = CVCensorCode
247-
elif type == 'dataqualitytype':
252+
elif cvtype == 'dataqualitytype':
248253
CV = CVDataQualityType
249-
elif type == 'dataset type':
254+
elif cvtype == 'dataset type':
250255
CV = CVDataSetType
251-
elif type == 'Directive Type':
256+
elif cvtype == 'Directive Type':
252257
CV = CVDirectiveType
253-
elif type == 'Elevation Datum':
258+
elif cvtype == 'Elevation Datum':
254259
CV = CVElevationDatum
255-
elif type == 'Equipment Type':
260+
elif cvtype == 'Equipment Type':
256261
CV = CVEquipmentType
257-
elif type == 'Medium':
262+
elif cvtype == 'Medium':
258263
CV = CVMediumType
259-
elif type == 'Method Type':
264+
elif cvtype == 'Method Type':
260265
CV = CVMethodType
261-
elif type == 'Organization Type':
266+
elif cvtype == 'Organization Type':
262267
CV = CVOrganizationType
263-
elif type == 'Property Data Type':
268+
elif cvtype == 'Property Data Type':
264269
CV = CVPropertyDataType
265-
elif type == 'Quality Code':
270+
elif cvtype == 'Quality Code':
266271
CV = CVQualityCode
267-
elif type == 'Relationship Type':
272+
elif cvtype == 'Relationship Type':
268273
CV = CVRelationshipType
269-
elif type == 'Result Type':
274+
elif cvtype == 'Result Type':
270275
CV = CVResultType
271-
elif type == 'Sampling Feature Geo-type':
276+
elif cvtype == 'Sampling Feature Geo-type':
272277
CV = CVSamplingFeatureGeoType
273-
elif type == 'Sampling Feature Type':
278+
elif cvtype == 'Sampling Feature Type':
274279
CV = CVSamplingFeatureType
275-
elif type == 'Site Type':
280+
elif cvtype == 'Site Type':
276281
CV = CVSiteType
277-
elif type == 'Spatial Offset Type':
282+
elif cvtype == 'Spatial Offset Type':
278283
CV = CVSpatialOffsetType
279-
elif type == 'Speciation':
284+
elif cvtype == 'Speciation':
280285
CV = CVSpeciation
281-
elif type == 'Specimen Type':
286+
elif cvtype == 'Specimen Type':
282287
CV = CVSpecimenType
283-
elif type == 'Status':
288+
elif cvtype == 'Status':
284289
CV = CVStatus
285-
elif type == 'Taxonomic Classifier Type':
290+
elif cvtype == 'Taxonomic Classifier Type':
286291
CV = CVTaxonomicClassifierType
287-
elif type == 'Units Type':
292+
elif cvtype == 'Units Type':
288293
CV = CVUnitsType
289-
elif type == 'Variable Name':
294+
elif cvtype == 'Variable Name':
290295
CV = CVVariableName
291-
elif type == 'Variable Type':
296+
elif cvtype == 'Variable Type':
292297
CV = CVVariableType
293298
else:
294299
return None

0 commit comments

Comments
 (0)