AWS Thinkbox Discussion Forums

API Request: Cleaner "getters" for plugin info entries

Currently, the API defines two versions of every plugin info entry getter: one which accepts a default and one which does not. What I’m proposing is merging the two functions for each value type into a single getter, with each one accepting an optional second argument for a default value. Basically, the behavior would be similar to dict.pop in Python (without deleting the value, obviously)

Proposals:

  • Remove the current ‘*Default’ variants of each getter.
  • Have each getter default to some NO_VALUE singleton constant (not None) that would cause the function to raise an exception if no actual value were present.

Sample Python code:

[code]def getBooleanPluginInfoEntry(self, key, default=NO_VALUE):
# If key found in plugin info, return value from file
# …
if default is NO_VALUE:
raise InvalidPluginInfoKey(key)
return default

Raises an exception if no entry exists for ‘Camera’

self.getBooleanPluginInfoEntry(‘Camera’)

Returns None if no entry exists for ‘Camera’

self.getBooleanPluginInfoEntry(‘Camera’, None)[/code]

Thanks,

-Nathan

We can add this to the wishlist, but it’s probably a low priority since the current system is working. :slight_smile:

No problem, just wanted to get it on a list somewhere.

Thanks

Privacy | Site terms | Cookie preferences