Opened 7 years ago

Closed 7 years ago

#7124 closed defect (worksforme)

Label disappears if not explicitly re-specified

Reported by: harbulot Owned by: obs
Priority: normal Component: BlackMagicTicketTweaksPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11



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).

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/   (revision 7944)
+++ 0.11/blackmagic/   (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,


Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by obs

  • Status changed from new to assigned

Weird it worked on 0.11.7 I'll check it out.

comment:2 Changed 7 years ago by obs

  • Resolution set to worksforme
  • Status changed from assigned to closed

Tested on trac 0.11.7 works fine, upgrade your trac installation.

Add Comment

Modify Ticket

as closed The owner will remain obs.
The resolution will be deleted. Next status will be 'reopened'.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.