Project

General

Profile

Actions

Cleanup #49363

open

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

Added by Ernesto Puerta about 3 years ago. Updated about 3 years 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.
Actions #1

Updated by Ernesto Puerta about 3 years ago

  • Project changed from mgr to Dashboard
  • Category changed from 132 to General
Actions

Also available in: Atom PDF