Modify ↓
#9256 closed enhancement (fixed)
Use configuration API instead of directly using `self.config.get()`.
Reported by: | Jun Omae | Owned by: | iwata0303 |
---|---|---|---|
Priority: | normal | Component: | TracBlockDiagPlugin |
Severity: | normal | Keywords: | |
Cc: | Trac Release: | 0.12 |
Description
The plugin retrieves directly the configurations using self.config.get()
.
I think it should use configuration API instead. It would be able to edit the configuration via iniadmin.
-
blockdiagplugin/web_ui.py
8 8 9 9 10 10 from trac.core import * 11 from trac.config import Option 11 12 from trac.wiki import IWikiMacroProvider 12 13 from trac.web import IRequestHandler 13 14 from trac.wiki.formatter import system_message … … 104 105 http://tk0miya.bitbucket.org/actdiag/build/html/index.html and http://tk0miya.bitbucket.org/nwdiag/build/html/index.html 105 106 """ 106 107 implements (IWikiMacroProvider, IRequestHandler) 108 109 _default_type = Option('blockdiag', 'default_type', 'png', 110 doc="Default output format type which will be used when the type " 111 "isn't given.") 112 113 _font = Option('blockdiag', 'font', '', 114 doc="Path to a font file to draw a diagram.") 107 115 108 116 macros = None 109 117 … … 128 136 if name[-4:] in ('_svg', '_png'): 129 137 name, type = name.split('_') 130 138 else: 131 type = (args.get('type') or self. env.config.get('blockdiag', 'default_type', 'png')).lower()139 type = (args.get('type') or self._default_type).lower() 132 140 if type not in ('svg', 'png'): 133 141 return system_message("Invalid type(%s). Type must be 'svg' or 'png'" % type) 134 142 135 font = self. env.config.get('blockdiag', 'font', '')143 font = self._font 136 144 137 145 # nonascii unicode can't be passed to hashlib. 138 146 id = make_hash('%s,%s,%s,%r' % (name, type, font, content)).hexdigest()
Attachments (0)
Change History (3)
comment:1 Changed 13 years ago by
comment:2 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 13 years ago by
Btw, I closed this because it looked like someone just forgot to do that, but please correct if I'm wrong.
Note: See
TracTickets for help on using
tickets.
(In [10908]) see #9256 Use configuration API instead of direct access to Component.config.get (Thanks jun66j5)