Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publisher missing GET variables #144

Open
graywh opened this issue Feb 5, 2025 · 3 comments
Open

Publisher missing GET variables #144

graywh opened this issue Feb 5, 2025 · 3 comments

Comments

@graywh
Copy link

graywh commented Feb 5, 2025

It looks like the publisher handler is failing to pass 3-letter (and possibly shorter) GET variables to the function. I'm running 3.5.0.1 that's packaged for Debian.

@grisha
Copy link
Owner

grisha commented Feb 5, 2025

@graywh are you saying that if you make the variable 4 leterd long they do get passed? Can you provide a slightly more detailed example?

@graywh
Copy link
Author

graywh commented Feb 5, 2025

Initially noticed because day wasn't working, but year and month did. Also, uid wasn't working, but usid did. This is an app that I created nearly 20 years ago and recently updated the OS from Debian buster to bookworm.

@graywh
Copy link
Author

graywh commented Feb 6, 2025

index.py

def view(req, year=None, month=None, day=None):
    today = datetime.datetime.today()
    if not year:
        year = today.year
    if not month:
        month = today.month
    if not day:
        day = today.day
    year = int(year)
    month = int(month)
    day = int(day)
    req.content_type = 'text/html'
    tmpl = psp.PSP(req, filename='_templates/view.tmpl')
    tmpl.run({'year':year,
      'month':month,
      'day':day})

_templates/view.tmpl

<%
months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
%>
<html><head></head><body>
<form action="add" method="get"><%
for j in [1,2]:
    # indent
%>
<select name="month<%= str(j) %>"><%
    for i, m in enumerate(months):
        # indent
%>
    <option value="<%= str(i + 1) %>"<%
        if i + 1 == month:
            # indent
            %> selected<%
        # end if
    %>><%= m %></option><%
    # end for
%>
</select>
<select name="day<%= str(j) %>"><%
    for i in range(1,32):
        # indent
%>
    <option value="<%= str(i) %>"<%
        if i == day:
            # indent
            %> selected<%
        # end if
    %>><%= str(i) %></option><%
    # end for
%>
</select>
<input type=submit value="Submit">
</form>
</body></html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants