The problem was with the validation code. Within the python section of the
template, the class IPv4Interface will throw an exception due to the invalid
value during the validation process. Therefore, the server rejects the form
data and the template is not created.
Solution: It would work if you add an error handling to the python section of
the template.
<%!
## python module-level code
import ipaddress
%>
<%def name="get_address(ip_string)">
<%
try:
return ipaddress.IPv4Interface(ip_string).ip
except Exception:
return "FAIL_OR_EMPTY"
%>
</%def>
! Variable Input: ${LAN_IP}
${get_address(LAN_IP)}
Explanation: During the server-side validation of the HTML form, the
configuration template is rendered with a dummy parameter set to verify the
syntax (see file app/forms.py, class ConfigTemplateForm). Your config template
is validated with the following parameter set during the form validation:
{
"hostname": "test",
"LAN_IP": "test"
}
--
https://mail.python.org/mailman/listinfo/python-list