Graham Dumpleton
grahamd at dscpl.com.au
Wed Nov 24 06:27:29 EST 2004
In a mad rush just prior to going on holidays, I have decided to push out Vampire 1.3. As far as I remember the last time I touched it it was ready, but have just been too busy to do anything about it. The post by Rune mentioning config files has made me decide to throw it out now as the changes in Vampire 1.3 in that area may be mildly interesting to that discussion. I'll post more about the config support as followup to that separate discussion. Vampire can be found at: http://www.dscpl.com.au/projects/vampire Check the web site for a full description of what Vampire is, but in short it provides a way of better organising content handlers, plus various other bits and pieces. Changes in version 1.3 are listed below. Enjoy. Changes in Vampire 1.3 ====================== - Include a workaround for a bug which is present in mod_python when running on Win32 platform which would have caused search algorithm for config file to fail. Problem with mod_python is that it errornously adds a trailing '\' to the name of the directory where the original PythonHandler directive was declared, when it should have been '/' and should only have been added when a trailing '/' wasn't already present. The remainder of the path as supplied by Apache uses the POSIX path separator and this was being depended upon, but mod_python was breaking that. A separate patch is not provided in PATCHES because a workaround is possible. Bug was posted on the mod_python mailing list, although no one has acknowledged it is a valid problem. - The names of the special predefined variables defined within the configuration system and which are available for string interpolation in configuration have changed. New names are as follows: __root__ --> __config_root__ __file__ --> __config_file__ __mtime__ --> __config_mtime__ __base__ --> __baseurl_abs__ Although these are officially the new names, some tricks are done to ensure the old names still work for now. The names are also no longer added to the DEFAULT section of the config object, but are made available for string interpolation in another way. They thus will not appear in any section of the config object if names defined in a section are iterated over. The following extra special variables have also now been added. __handler_root__ --> Where PythonHandler directive was defined. __baseurl_rel__ --> Base URL relative to the current request. Although the names are no longer added into the DEFAULT section of the config file, they can still be accessed using the "defaults()" method of the config object returned by "loadConfig()". Any variables defined in a .htaccess file or httpd.conf file using the PythonOption directive are now automatically loaded into the config in a way that they are also available for string interpolation without the need to explicitly specify them using the "vars" variable when getting the value of a configuration option. Variables defined in the .htaccess file using the PythonOption directive will themselves have string interpolation performed upon them when used via the configuration mechanism. Thus, one could actually define: PythonOption LayoutRoot %(__handler_root__)s Then in the configuration file, one can use: [Handlers] handler_html = %(LayoutRoot)s/layout/handler_html.py handler_pdf = %(LayoutRoot)s/layout/handler_pdf.py In this examples, this would be equivalent to having used: [Handlers] handler_html = %(__handler_root__)s/layout/handler_html.py handler_pdf = %(__handler_root__)s/layout/handler_pdf.py Doing it this way though, means that the .htaccess file can be used to set explicit values, or reference back to the dynamic values generated when the search for the config file was performed. - When turning on default content handlers using the directive: PythonOption VampireDefaultHandlers On it is now possible to override the default name of the configuration file used to find the default handlers and what section in that configuration file is consulted. Thus: PythonOption VampireHandlersConfig .vampire PythonOption VampireHandlersSection Handlers The values ".vampire" and "Handlers" represent the inbuilt defaults, but by setting these, they can be overridden. -- Graham Dumpleton (grahamd at dscpl.com.au)
|