Choices
from hanna import Configurable, String
class Settings(Configurable):
log_level = String(choices=('info', 'warn', 'error'))
log_level.choices = ('info', 'warn', 'error') # Similar.# raises ValueError: "log_level" Illegal choice ('debug' not in ('info', 'warn', 'error'))
settings = Settings({'log_level': 'debug'})Last updated