PSP Examples

Hello from PSP!

Python Server Pages

This is the sample/test page
for an implementation of
Python Server Pages.

This version of the test page uses braces as the indent type.

Read the PSP documentation. See the source for this page.

The text below comes from another psp page which was inserted into this one with the <%@ include %> directive.

Hello from included file!

Fri Sep 20 02:31:11 2024

There are actually two ways to insert the contents of another file into a PSP page:

If you use <%@ include file="somefile" %>, it will effectively insert the contents of the other file before class creation time.

Using <psp:include path="somefile"> will insert the output of the specified WebKit URL into the page dynamically.


This is A HTML file that is dynamically inserted.


Time at which dynamic output was generated:

Fri Sep 20 02:31:11 2024


Below is a loop test:

Loops are the trickiest part of PSP due to Python indentation for blocks syntax.

The use of braces, while not good for normal Python, does make things easier here where we are dealing with HTML.

  • Outer loop: 1
    • Inner loop: 1 (still in the inner loop)
    • Inner loop: 2 (still in the inner loop)
  • Outer loop: 2
    • Inner loop: 1 (still in the inner loop)
    • Inner loop: 2 (still in the inner loop)

Unix system info:

OS name: Linux
Hostname: ddsubuntu1804
OS release: 4.15.0-112-generic
OS version: #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020
Hardware: x86_64

Path Info:/PSP/Examples/PSPTests-Braces
extraURLPath:
Fields:{}
servletURI:/PSP/Examples/PSPTests-Braces
uriWebKitRoot: ../../
serverURL:http://didiosistemas.com.ar:18084/PSP/Examples/PSPTests-Braces
serverURLDir:http://didiosistemas.com.ar:18084/PSP/Examples/

Request Variables:

HTTP_ACCEPT */*
HTTP_USER_AGENT Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
REMOTE_PORT 1490
GATEWAY_INTERFACE CGI/1.1
REMOTE_ADDR 3.149.242.190
SERVER_SOFTWARE Webware/1.0.2
SCRIPT_NAME 
REQUEST_METHOD GET
HTTP_HOST didiosistemas.com.ar:18084
PATH_INFO /PSP/Examples/PSPTests-Braces
SERVER_PORT 18084
SERVER_PROTOCOL HTTP/1.0
QUERY_STRING 
PATH /usr/lib/jvm/java-8-openjdk-amd64/bin:/usr/bin:/bin
HTTP_ACCEPT_ENCODING gzip, br, zstd, deflate
SERVER_ADDR 0.0.0.0
REQUEST_URI /PSP/Examples/PSPTests-Braces

Comments:

PSP comments will not show up in the source of the page.

Nothing should be visible here.


Testing a class method defined in the PSP code:

I'm a method. Howdy!


pass can be used to end a block, so test that it can be used by itself too!

If-Test: It's True


That's all, folks.

Fri Sep 20 02:31:11 2024