We have a utility function called obj_or_id that is used across the library. It is designed to allow the user to provide either the canvas ID of an resource as an int, or let the library find the ID from an object automatically.
We also have a function called obj_or_str that appears to attempt doing a similar thing, albeit with type of str instead of int. Despite looking similar, it doesn't actually respect the user passing in a str. While the docstring for obj_or_str doesn't claim to work like obj_or_id, it's clear from usage in other functions that we expected it to.
It looks like obj_or_str has limited reach - only on functions related to canvasapi.feature.Feature objects:
canvasapi.account.Account.get_feature_flag()
canvasapi.course.Course.get_feature_flag()
canvasapi.feature.FeatureFlag.delete()
canvasapi.feature.FeatureFlag.set_feature_flag()
canvasapi.user.User.get_feature_flag()
Update obj_or_str to be more in line with obj_or_id.
We have a utility function called
obj_or_idthat is used across the library. It is designed to allow the user to provide either the canvas ID of an resource as anint, or let the library find the ID from an object automatically.We also have a function called
obj_or_strthat appears to attempt doing a similar thing, albeit with type ofstrinstead ofint. Despite looking similar, it doesn't actually respect the user passing in astr. While the docstring forobj_or_strdoesn't claim to work likeobj_or_id, it's clear from usage in other functions that we expected it to.It looks like
obj_or_strhas limited reach - only on functions related tocanvasapi.feature.Featureobjects:canvasapi.account.Account.get_feature_flag()canvasapi.course.Course.get_feature_flag()canvasapi.feature.FeatureFlag.delete()canvasapi.feature.FeatureFlag.set_feature_flag()canvasapi.user.User.get_feature_flag()Update
obj_or_strto be more in line withobj_or_id.