Re: [viewvc-users] Looking for a template variable
John Beranek <[email protected]>
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.user |
|---|---|
| Organization | Pace plc |
| Message-ID | <[email protected]> |
On 06/04/10 17:20, C. Michael Pilato wrote: > John Beranek wrote: >> Sorry for the late reply, it took a while before I had time to try this. >> It does work quite well except for one proviso. It seems you can't have >> conditional parts of templates that use config variables that may or may >> not be set. So, for example I couldn't do: >> >> [if-any cfg.general.mirror_site]blah[end] >> >> If 'mirror_site' wasn't defined in the config I would get a Python >> backtrace. The way I've worked around it is something like: >> >> [is cfg.general.mirror_site "none"][else]blah[end] >> >> This still relies on the config variable being set, but at least it >> allows sections to be turned off entirely by use of a special "none" value. > > ViewVC does support (and I can't believe I didn't think of this before) a > generic key-value configuration store accessible to the templates. Search > for "kv_files" in your viewvc.conf file. Ah, thanks. However this doesn't help with the Python backtrace. If you try to use a kv value that hasn't been set you get: UnknownReference: kv.mysection.myvar Cheers, John. -- John Beranek To generalise is to be an idiot. http://redux.org.uk/ -- William Blake ------------------------------------------------------ http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4255&dsMessageId=2509002 To unsubscribe from this discussion, e-mail: [[email protected]].