Modify ↓
Opened 8 years ago
Closed 7 years ago
#12779 closed defect (fixed)
[logging] log_level option is case-sensitive after Trac 1.2
Reported by: | Jun Omae | Owned by: | Ryan J Ollos |
---|---|---|---|
Priority: | normal | Milestone: | 1.2.2 |
Component: | general | Version: | 1.2 |
Severity: | minor | Keywords: | |
Cc: | Branch: | ||
Release Notes: |
Fixed |
||
API Changes: |
Added |
||
Internal Changes: |
Description
$ ~/venv/trac/1.0.13/trac-admin /dev/shm/tracenv-1.0 Welcome to trac-admin 1.0.13 Interactive Trac administration console. Copyright (C) 2003-2013 Edgewall Software Type: '?' or 'help' for help on commands. Trac [/dev/shm/tracenv-1.0]> config get logging log_level info Trac [/dev/shm/tracenv-1.0]> $ ~/venv/trac/1.2/trac-admin /dev/shm/tracenv-1.0 Welcome to trac-admin 1.2 Interactive Trac administration console. Copyright (C) 2003-2013 Edgewall Software Type: '?' or 'help' for help on commands. Trac [/dev/shm/tracenv-1.0]> upgrade Error: [logging] log_level: expected one of ("ALL", "CRITICAL", "DEBUG", "ERROR", "INFO", "WARN", "WARNING"), got u'info'
Attachments (0)
Change History (5)
comment:1 by , 8 years ago
Owner: | set to |
---|---|
Release Notes: | modified (diff) |
Status: | new → assigned |
comment:2 by , 8 years ago
Alternative patch:
-
trac/config.py
commit a1cdc51045c544364e40e7ceea31ded4540d30bd Author: Ryan J Ollos <ryan.j.ollos@gmail.com> Date: Wed Apr 19 09:40:34 2017 -0700 Allow arbitrary function diff --git a/trac/config.py b/trac/config.py index cd43e8887..0aada371b 100644
a b class ChoiceOption(Option): 819 819 """ 820 820 821 821 def __init__(self, section, name, choices, doc='', doc_domain='tracini', 822 doc_args=None ):822 doc_args=None, fn=None): 823 823 Option.__init__(self, section, name, to_unicode(choices[0]), doc, 824 824 doc_domain, doc_args) 825 825 self.choices = set(to_unicode(c).strip() for c in choices) 826 self.fn = fn 826 827 827 828 def accessor(self, section, name, default): 828 829 value = section.get(name, default) 830 if self.fn: 831 value = self.fn(value) 829 832 if value not in self.choices: 830 833 raise ConfigurationError( 831 834 _('[%(section)s] %(entry)s: expected one of ' -
trac/env.py
diff --git a/trac/env.py b/trac/env.py index 0ecbb5b42..40b676182 100644
a b class Environment(Component, ComponentManager): 250 250 """Level of verbosity in log. 251 251 252 252 Should be one of (`CRITICAL`, `ERROR`, `WARNING`, `INFO`, `DEBUG`). 253 """ )253 """, fn=unicode.upper) 254 254 255 255 log_format = Option('logging', 'log_format', None, 256 256 """Custom logging format.
If we go with this patch we probably want to extend the changes to apply to Option
and its derivative classes.
comment:3 by , 8 years ago
Yet another option would be to subclass ChoiceOption
and create a case-insensitive class with otherwise the same behavior, ChoiceOptionI
.
comment:4 by , 8 years ago
Milestone: | next-stable-1.2.x → 1.2.2 |
---|
Note:
See TracTickets
for help on using tickets.
Regression from #11573. We could add a
case_sensitive
argument toChoiceOption
.trac/config.py
):trac/env.py
)I would prefer to not make
case_sensitive
be the last argument in the list, but I suppose that is required for backward-compatibility.