Project

General

Profile

Cleanup #49363

mgr/dashboard: remove settins.py module and refactor MODULE_OPTIONS

Added by Ernesto Puerta 3 months ago. Updated 22 days ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
General
Target version:
% Done:

0%

Tags:
Backport:
Reviewed:
Affected Versions:
Pull request ID:

Description

It's no longer necessary, creates lots of unnecessary CLI commands and overrides some existing/better behaviours. Anything identified that is positive, it should be moved to mgr_module level (or mgr_utils) so that other modules can benefit from it.

Perhaps a possibility would be to replace MODULE_OPTIONS with a class that provides better functionality and encapsulates code:


MODULE_OPTIONS = ModuleOptions([
 Option('foo', int)
])

...

self.MODULE_OPTIONS['foo'] = 'bar'

print(self.MODULE_OPTIONS['foo'])
>>> 'bar'

It might bring some extra features:
  • If option runtime is False, the value is fetched at the beginning and cached since then.
  • Provide mypy/typing hints/generics.

History

#1 Updated by Ernesto Puerta 22 days ago

  • Project changed from mgr to Dashboard
  • Category changed from dashboard/general to General

Also available in: Atom PDF