Turning out, it's a little more complicated than this.

Normally, the directive #errorCatcher at the top of the template causes a
malformed tag like $obs.label.foo to be trapped, and Cheetah emits the
literal string '$obs.label.foo'.

But, like the #encoding directive, the #errorCatcher directive has to be
included in *every* file, even included files. None of the newskin "*.inc"
files include it.

So, that presents a fourth option:

4. Include #errorCatcher in all the included files.

I actually prefer this one. It causes Cheetah to do what my proposed fix #3
would have done: substitute something else. It has the added advantage that
the "something else" is a lot easier to understand than what I was
thinking. That is, it's easier to understand '$obs.label.foo' than just a
simple 'foo'. It's also a lot easier to diagnose than one of those cryptic
Cheetah exceptions that I got.

So, I would propose including #errorCatcher on the top of all the included
files.

-tk

On Sun, Jan 29, 2017 at 9:04 AM, Thomas Keffer <[email protected]> wrote:

> I get many errors of the form:
>
> Jan 29 08:38:04 nuc wee_reports[20026]: cheetahgenerator: Generate failed
> with exception '<class 'NameMapper.NotFound'>'
> Jan 29 08:38:04 nuc wee_reports[20026]: cheetahgenerator: **** Ignoring
> template /home/weewx/skins/Standard/index.html.tmpl
> Jan 29 08:38:04 nuc wee_reports[20026]: cheetahgenerator: **** Reason:
> cannot find 'extraTemp1' while searching for 'obs.label.extraTemp1'
> Jan 29 08:38:04 nuc wee_reports[20026]: ****  Traceback (most recent call
> last):
> Jan 29 08:38:04 nuc wee_reports[20026]: ****    File
> "/home/tkeffer/git/weewx/bin/weewx/cheetahgenerator.py", line 329, in
> generate
> Jan 29 08:38:04 nuc wee_reports[20026]: ****      print >> _file, text
> Jan 29 08:38:04 nuc wee_reports[20026]: ****    File
> "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1005, in
> __str__
> Jan 29 08:38:04 nuc wee_reports[20026]: ****      rc = getattr(self,
> mainMethName)()
> Jan 29 08:38:04 nuc wee_reports[20026]: ****    File
> "_home_weewx_skins_Standard_index_html_tmpl.py", line 212, in respond
> Jan 29 08:38:04 nuc wee_reports[20026]: ****    File
> "/usr/lib/python2.7/dist-packages/Cheetah/Template.py", line 1615, in
> _handleCheetahInclude
> Jan 29 08:38:04 nuc wee_reports[20026]: ****      self._CHEETAH__
> cheetahIncludes[_includeID].respond(trans)
> Jan 29 08:38:04 nuc wee_reports[20026]: ****    File
> "_home_tkeffer_git_weewx_skins_Standard_current_inc.py", line 240, in
> respond
> Jan 29 08:38:04 nuc wee_reports[20026]: ****  NotFound: cannot find
> 'extraTemp1' while searching for 'obs.label.extraTemp1'
> Jan 29 08:38:04 nuc wee_reports[20026]: cheetahgenerator: Generate failed
> with exception '<class 'NameMapper.NotFound'>'
>
> This is because 'extraTemp1' is missing from [Labels] [[Generic]].
>
> Three ways to fix:
>
>    1. Include it in [Labels][[Generic]]
>    2. Remove $obs.label.extraTemp1 from current.inc (and friends)
>    3. Modify units.ObsInfoHelper so it returns something that when keyed
>    by a non-existent obstype, returns the key itself.
>
> Option #3 is by far the best. I'll fix this. Note that this is a problem
> for any skin, not just newskin.
>
> -tk
>
>
>
>
> On Sun, Jan 29, 2017 at 7:41 AM, mwall <[email protected]>
> wrote:
>
>> here is another update to the new Standard replacement candidate:
>>
>> http://lancet.mit.edu/mwall/projects/weewx-newskin/
>>
>> changes include:
>>
>> - separate page for celestial details
>> - consolidate and simplify css
>> - a new 'sensor status' section
>> - modified simulator to emit battery status, voltages, signal strength
>> - refined the color scheme
>> - use of truetype fonts and woff fonts for unified typeface throughout
>> the report
>>
>> the sensor status *should* automatically adapt, depending on what sensors
>> you have attached.  feedback would be appreciated from those with stations
>> that have sensor status.  (the sensor status only uses fields from the
>> wview schema - we'll have to update this report when we introduce the
>> extended schema with per-sensor diagnostics)
>>
>> code is on the newskin branch.
>>
>> m
>>
>
>

Reply via email to