Modify ↓
Opened 14 years ago
Closed 14 years ago
#7124 closed defect (worksforme)
Label disappears if not explicitly re-specified
Reported by: | Bruno Harbulot | Owned by: | obs |
---|---|---|---|
Priority: | normal | Component: | BlackMagicTicketTweaksPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description
Hi,
The label of a (custom) field does not show up at all if it's tweaked. I'm using blackmagic (r7886) and Trac 0.11.6.
The reason for this is that the label is loaded using this:
self.enchants[e]["label"]=self.config.get('blackmagic','%s.label' % e, None)
Unfortunately, None
doesn't work as a default value with config.get()
(at least in Trac 0.11 and the current trunk).
- http://trac.edgewall.org/browser/branches/0.11-stable/trac/config.py?rev=8819
- http://trac.edgewall.org/browser/trunk/trac/config.py?rev=9669
Just before returning from get()
in the Section
class, there's this:
if not value: value = u''
Perhaps a patch like this would be better?
--- 0.11/blackmagic/blackmagic.py (revision 7944) +++ 0.11/blackmagic/blackmagic.py (working copy) @@ -%ld,%ld +%ld,%ld @@ self.enchants[e]["disable"]=self.config.get('blackmagic','%s.disable' % e, False) self.enchants[e]["hide"]=self.config.get('blackmagic','%s.hide' % e, False) self.enchants[e]["label"]=self.config.get('blackmagic','%s.label' % e, None) + # config values cannot be None, always initialised to u'' if nothing found + if not self.enchants[e]["label"]: + self.enchants[e]["label"] = None self.enchants[e]["notice"]=self.config.get('blackmagic','%s.notice' % e, None) self.enchants[e]["tip"]=self.config.get('blackmagic', '%s.tip' % e, None) self.enchants[e]["ondenial"]=self.config.get('blackmagic','%s.ondenial' % e, "disable")
Then, people who want to hide the label could use a space instead of nothing.
Best wishes,
Bruno.
Attachments (0)
Change History (2)
comment:1 Changed 14 years ago by
Status: | new → assigned |
---|
comment:2 Changed 14 years ago by
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
Tested on trac 0.11.7 works fine, upgrade your trac installation.
Note: See
TracTickets for help on using
tickets.
Weird it worked on 0.11.7 I'll check it out.