Red-DiscordBot icon indicating copy to clipboard operation
Red-DiscordBot copied to clipboard

[Config] Prevent registering defaults for inaccessible identifiers

Open Flame442 opened this issue 2 years ago • 1 comments

What component of Red (cog, command, API) would you like to see improvements on?

Config

Describe the enhancement you're suggesting.

When registering defaults, we already check that the key is not a Python identifier, however we do not ever check whether the key is an existing attribute of Group or Value that will cause the __getattr__ method to never be called. Examples include:

  • default
  • defaults
  • identifier_data
  • is_value

And more!

A similar check should be added to ensure the key is actually going to be accessible, in order to prevent confusion.

Anything else?

No response

Flame442 avatar Feb 07 '24 20:02 Flame442

+1 on this, would be an important addition especially with the default identifier as I see that getting used occasionally.

Kreusada avatar Feb 08 '24 16:02 Kreusada