PerServ - install example


Overall file structure

Example is a dynamic PerServ package which serves as a template for your own app development. It is distributed as a . You unpack it into the psd3 directory. After unpack, the directory tree will look like:
            psd3
               |
               +-- example
                      |
                      +-- app_icon.png
                      +-- example.py
                      +-- example.xml

The name of the directory, the python (py extension), and internal references are all identically "example". To make your own distributable app, copy the example directory to, say, "myownapp" and change all occurrences in file/directory names and internally of "example" to "myownapp". The psd3 directory now looks like this:

            psd3
               |
               +-- example
               |      |
               |      +-- app_icon.png
               |      +-- example.py
               |      +-- example.xml
               |
               +-- myownapp
                      |
                      +-- app_icon.png
                      +-- myownapp.py
                      +-- myownapp.xml
If you do not see myownapp, reboot the server. Note that the identification of myownapp on menu is "Myown". The menu identification is truncated at first 5 characters of directory name.

app_icon.png

The app_icon.png file under myownapp is a square image 48x48 pixels or greater. You can use jpg or gif format format readable by user's web browser.

myownapp.py

The entry point in myownapp.py has the fixed name myownapp_init(). The psdyn.py file contains definition of utility routines and constants. All definitions start with "psd_" and this prefix is reserved for system defined names. See the psdyn.py import file at psd3/psdyn.py for complete list.

We recommend that the routines named webpage_entry and resident_scan are good candidates for moving to separate modules. Names of those modules should incorporate the name of your app as a prefix so that there is no name collision with other authors or DAIR Systems LLC.

You are guaranteed that the processing of myownapp.xml has been applied before myownapp_init() is called.

myownapp.xml

This is an optional file for supporting multi-account and multi-user extensions. It specifies the prototype for the account file (1 or more users per account) and the slot file (1 file per each user).

The distributed file is blank. A structure which places content in the acct and slot files is:

        <proto>
            <acct>
                acct_content
            </acct>
            <slot>
                slot_content
            </slot>
        </proto>

After first initialization, the acct file contains:
        <psdyn>
            <myownapp>
                acct_content
            </myownapp>
        </psdyn>

and the slot file for each user contains:
        <psdyn>
            <myownapp>
                slot_content
            </myownapp>
        </psdyn>

Over time, you may read and/or modify acct_content and slot_content. This is facilitated if each is a hierarchical tree of single word tags and no attributes. Despite file extension name, PerServ xml files are a subset of XML.