Skip to content
Malex edited this page Mar 1, 2011 · 4 revisions

THIS INFORMATIONS ARE REFERRED TO VERSION 0.1. NEWER VERSION ARE INCOMPATIBLE WITH MOST OF THESE FEATURES

FrozenFW gives a simple way to write your webpages: simply write an (x)html page, putting your variable in curly {} brackets.

For exemple, in my template file I can write this:

{title}

In my py script, I only have to write this simple line:

print(title=“index”)

and the title will be, of course, “index”. You can, of course, put as keyword arguments as you want, they will be all processed.
The Content-Type and other headers are set by the rc, but if you have to change them “on the fly”, you can simply write

Output.set_headers(*headers_list)

If you have to open a file, please do not use the open() function: the framework provides a File class that gives you everything you need: with statement support, read and write methods etc. But it is useful for a security reason: you can set which paths are allowed and which not, so you are sure to avoid dangerous lfi. Besides it gives you two useful static methods: File.parse, that replace the occurences of ~ with the content of $HOME variable and, if you are running it on windows, in replace the / with backslashes; and File.get_contents, that returns the content of a file very fast, without needing to open, read and close it.

Besides, the ffw gives you other useful functions: htmlspecialchars, htmlentities and addslashes, that work exactly as the php function, nl2br, to replace \n character with <br /> before outputting html contents, and deBrand, a function used to obtaing the original content of the query string (since non-alphabetical characters are replaced with their hex value, preceded by a %).

Clone this wiki locally