FPU Packet Pickup Main Script¶
Below is the main Python script used for the FPUPacketPickup sample project with explanation following.
This file should be located under Admin > Special Content > PythonScripts tab, and be named FPUPacket. It goes under this tab because it can be run directly from the editor which will show you the URL to launch it for your users.
1 2 3 4 5 6 7 8
if model.HttpMethod == 'get': html = model.Content("FPUPacketForm.html") model.Form = model.RenderTemplate(html) model.Script = model.Content("FPUPacket.js") elif model.HttpMethod == 'post': print model.CallScript('FPUPacketProcess.py')
This script is short but is responsible for routing the process. The model.HttpMethod indicates the page was called.
- Line 1-4
- Lines 6-7
If model.HttpMethod is post, that means that a button click or some other action was taken by the user. The rest of the process is routed to the FPUPacketProcess.py script.