With the help of gemini I could write a small Cheetah script to do what I 
need - of course this is only a kind of workaround/proof of concept. But it 
works:
  <div id="reports">
    #import os
    #import fnmatch
    #set $files = os.listdir('/var/www/html/weewx/NOAA')
    #set $months = fnmatch.filter($files, 
'NOAA-[0-9][0-9][0-9][0-9]-[0-9][0-9].txt')
    #set $years = fnmatch.filter($files, 'NOAA-[0-9][0-9][0-9][0-9].txt')
    $gettext("Monthly Reports"):
    <select name="reports" onchange="openTabularFile(value)">
      #for $month in $months
     #set $monthYear = os.path.splitext($month)[0]
 #set $monthYear = $monthYear[5:]
      <option value="$monthYear">$monthYear</option>
      #end for
      <option selected>- $gettext("select month") -</option>
    </select>
    <br/>
    $gettext("Yearly Reports"):
    <select name="reports" onchange="openTabularFile(value)">
      #for $year in $years
        #set $yr = os.path.splitext($year)[0]
#set $yr = $yr[5:]
      <option value="$yr">$yr</option>
      #end for
      <option selected>- $gettext("select year") -</option>
    </select>
    <br/>
  </div>
Anyhow I'm really impressed of the power of Cheetah!

Tom Keffer schrieb am Samstag, 25. Juli 2026 um 17:34:27 UTC+2:

> Client-side Javascript cannot read the web server's file system due to 
> security sandboxing. I can think of a few ways around that, but none is 
> very satisfying.
>
>    1. Turn directory indexing on for the NOAA subdirectory. Then fetch 
>    the list of files, parse them, and display. This is probably the best of 
>    the alternative approaches. I didn't use this because it requires a user 
> to 
>    modify his/her web server configuration.
>    2. Include some sort of manifest file, such as noaa.json. Retrieve 
>    that, parse, and display. Problem is that the manifest file has to be 
>    generated, so you're back to where you started.
>    3. Require a backend framework. You read the manifest from an 
>    endpoint. Again, this requires users to install infrastructure.
>
> The solution I came up with was the only one that required minimal 
> user modifications. If I have missed an idea, I'd love to hear about it!
>
> -tk
>
>
> On Sat, Jul 25, 2026 at 8:20 AM 'Michael Waldor' via weewx-user <
> [email protected]> wrote:
>
>> Thanks for your quick reply. The NOAA files are stored within the HTML 
>> area served by nginx, thus should be visible for a web browser. Only the 
>> selection is not possible because the variables are set by CheetahGenerator 
>> - as to be expected.
>>
>> Thus my best solution will be data migration. The author of the new 
>> ecowitt driver even provides an sql script for that purpose. I'll give it a 
>> try.
>>
>> Tom Keffer schrieb am Samstag, 25. Juli 2026 um 16:31:56 UTC+2:
>>
>>> Your question is not entirely clear to me, but what I think you're 
>>> asking is how do you gain access to the file names from within the webpage.
>>>
>>> The answer is that you can't. Modern web browsers don't allow free 
>>> access to the file system on the client, so you cannot search to see which 
>>> files have been generated. 
>>>
>>> Instead, the dropdown list that you see is created at file generation 
>>> time. The Cheetah generator keeps track of all files that should be there 
>>> and populates the list with that. 
>>>
>>> If at all possible, you would be best off figuring out some way of 
>>> migrating your old data to your new weewx.sdb file. Provided the data is 
>>> still in the flat format used by the database, this should be possible. 
>>> Have you tried using the "weectl database" utility for adding and removing 
>>> columns?
>>>
>>> -tk
>>>
>>> On Sat, Jul 25, 2026 at 5:58 AM 'Michael Waldor' via weewx-user <
>>> [email protected]> wrote:
>>>
>>>> Both variables are used within Seasons skin titlebar.inc to populate 
>>>> the month resp. year dropdown. Works fine.
>>>>
>>>> But now I've setup a new weatherstation with incompatible weewx.sdb DB 
>>>> structure (ecowitt_http_driver). Thus I'm forced to start with an empty 
>>>> weewx.sdb (because currently I want to avoid to migrate my old data). The 
>>>> folder  /var/www/html/weewx/NOAA still contains all old summaries, but 
>>>> I can't access them from Seasons gui, probabely because $SummaryByYear and 
>>>> $SummaryByMonth are initialized based on the current weewx.sdb.
>>>>
>>>> Is it possible to get access to the (existing) old NOAA files from 
>>>> within Seasons titlebar.inc? As a final resort I might hardwire the list 
>>>> of 
>>>> years within "my" titlebar.inc, but maybe there is a better solution?
>>>>
>>>> Regards, Michael
>>>>
>>>> -- 
>>>> 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 [email protected].
>>>> To view this discussion visit 
>>>> https://groups.google.com/d/msgid/weewx-user/37c7eed3-2bbd-4307-81af-ab61e6aca2efn%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/weewx-user/37c7eed3-2bbd-4307-81af-ab61e6aca2efn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> 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 [email protected].
>>
> To view this discussion visit 
>> https://groups.google.com/d/msgid/weewx-user/925d0362-f899-4025-88b1-8fcdbb21fd65n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/weewx-user/925d0362-f899-4025-88b1-8fcdbb21fd65n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/weewx-user/bf43a78e-900e-476b-935d-ce1a5e6608e4n%40googlegroups.com.

Reply via email to