Belchertown: Running a new index.htm.temp template

98 views
Skip to first unread message

weather list

unread,
Oct 31, 2020, 7:50:55 PM10/31/20
to weewx...@googlegroups.com
I’ve added a folder in the Belchertown folder, arranged it to show and work in the navigation header. I have a custom index.html.tmpl in that folder, and in Belchertown skin.conf:

But that template doesn’t run, even on a restart of weewx. What am I missing to cause that to happen?

Added:

[[ToDate]]
# Reports that show statistics "to date", such as day-to-date,
# week-to-date, month-to-date, etc.
[[[weewx_data]]]
template = json/weewx_data.json.tmpl

[[Belchertown]]
template = js/belchertown.js.tmpl

[[[home]]]
template = index.html.tmpl

[[[about]]]
template = about/index.html.tmpl

[[[graphs]]]
template = graphs/index.html.tmpl

[[[records]]]
template = records/index.html.tmpl

[[[forecast]]]
template = forecast/index.html.tmpl

[[[pi]]]
template = pi/index.html.tmpl

[[[manifest]]]
encoding = utf8
template = manifest.json.tmpl

Debian 10/Raspian Desktop
Intel NUC
WeeWx 4.1.1

Graham Eddy

unread,
Oct 31, 2020, 7:55:14 PM10/31/20
to weewx...@googlegroups.com
‘Belchertown’ has too few brackets

vince

unread,
Oct 31, 2020, 8:38:17 PM10/31/20
to weewx-user
On Saturday, October 31, 2020 at 4:55:14 PM UTC-7, Graham Eddy wrote:
‘Belchertown’ has too few brackets



It would be cool feature if weewx had a minimalist syntax checker for things like this:
 - look for unmatched [ ] pairs on one line
 - look for the incorrect number of [ ] like this example, within a higher-level section
 - and syslog something saying that it detected a possible error on which line in the .conf file 

We see this one pretty often, and some of us are in the 'we have done it too many times to admit' club too :-)

weather list

unread,
Oct 31, 2020, 9:18:20 PM10/31/20
to weewx...@googlegroups.com
Fixed but it appears to have no effect so far.

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/B86E6B8F-CA9E-4E4E-9E71-15847E7074A0%40gmail.com.

Graham Eddy

unread,
Oct 31, 2020, 9:22:55 PM10/31/20
to weewx...@googlegroups.com
i think the answer is yaml i.e. indentation (just like python :-)

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Graham Eddy

unread,
Oct 31, 2020, 9:30:22 PM10/31/20
to weewx...@googlegroups.com
‘no effect’ very unlikely. same outcome possible if more errors. post log around template generation

weather list

unread,
Oct 31, 2020, 10:44:54 PM10/31/20
to weewx...@googlegroups.com
Quite right, might be:
----------------------------
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: Generate failed with exception '<class 'NameMapper.NotFound'>'
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: **** Ignoring template /home/weewx/skins/Belchertown/forecast/index.html.tmpl
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: **** Reason: cannot find '_POST'
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: ****  Traceback (most recent call last):
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: ****    File "/home/weewx/bin/weewx/cheetahgenerator.py", line 322, in generate
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: ****      unicode_string = compiled_template.respond()
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: ****    File "_home_weewx_skins_Belchertown_forecast_index_html_tmpl.py", line 103, in respond
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: ****    File "/usr/lib/python3/dist-packages/Cheetah/Template.py", line 1707, in _handleCheetahInclude
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: ****      self._CHEETAH__cheetahIncludes[_includeID].respond(trans)
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: ****    File "_home_weewx_skins_forecast_noaacoastalforecastsmaine_php.py", line 131, in respond
Oct 31 22:35:31 raspberry-NUC62 weewx[17083] ERROR weewx.cheetahgenerator: ****  NameMapper.NotFound: cannot find '_POST'


Here is the index.html.tmpl page in question.

#errorCatcher Echo
#encoding UTF-8
#set global $page = "forecast"

#include "header.html.tmpl"

<div class="site-inner">
    <main class="content">
#include "page-header.inc"
#include "/home/weewx/skins/forecast/noaacoastalforecastsmaine.php"
    </main>
</div>

#include "footer.html.tmpl"


Graham Eddy

unread,
Oct 31, 2020, 11:04:49 PM10/31/20
to weewx...@googlegroups.com
presumably invalid _POST reference is in include file. but: ‘main’ is invalid html

Graham Eddy

unread,
Oct 31, 2020, 11:06:58 PM10/31/20
to weewx...@googlegroups.com
correction: ‘main’ is valid. (didn’t used to be..)

weather list

unread,
Oct 31, 2020, 11:43:34 PM10/31/20
to weewx...@googlegroups.com
I imagine you’re right. That file is a PHP file with several POST arguments. I don’t grasp why that offends the #include statement- I’ll dig into it.

weather list

unread,
Nov 1, 2020, 10:16:56 AM11/1/20
to weewx...@googlegroups.com
Is there then no way to include a PHP file which has POST arguments in it?

I guess this is the offending code:

<?php
if(! isset($_POST['ccode']) or $_POST['ccode'] == '') {
    $zone = 'ANZ153';
    $zone_name = "<span style=\"font-size: 150%; color: black; \">Forecast for Casco Bay (ANZ153)</span>\n";
    $zone_image = "<img src='images/gyxmz.jpg' align='middle' border='0' width='645' height='377' alt='' /><br />\n";
}

On 31 Oct, 2020, at 23:04, Graham Eddy <graha...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages