What the heck is a static string?

S
everal parts of the web site, display information which does not change as frequently as other information. e.g., Chairman of the department, anecdotes/footnotes in several pages. To encourage modular design of the website, these strings, henceforth called staticstrings, are not hard coded into the python scripts. Instead they are stored in the database. Each such static string, is stored under a key, and the pages which need to display them, get the actual string from the database and display them.

The biggest advantage is that they can be edited over the web, they are easy to locate... Moreover, some people can be allowed to edit the contents of some static strings. Everything dealing with static strings can be found in utils/static_strings.py. This file defines the StaticString, StaticStringControl and the StaticStringDisplay classes along with some useful functions.

One table in the database stores all the (key,string) pairs. Each such pair is given an id number called s_str_id, which is automagically generated. Another table stores the pairs (s_str_id, login). This decides who is allowed to edit what strings. Those who have permissions to 'edit' 'strings' (see admin/permissions), automatically have permissions to edit the contents of all the strings as well as decide who can edit what staticstring. Obviously, those who are given permission to edit a specific string, can do just that and cannot change the list of people who can edit that string.