Well, I coded up a prototype. It works OK. You can downlaod a copy from http://members.cox.net/dcasimiro/theme.proto.tar.bz2 (12.5kb)
Here is copy of the README file: This is a prototype of a theme engine for freevo 2. It is inspired by Ruby on Rails. The basic idea is to split the presentation into a model, view, and controller (MVC) componenets. In freevo, the 'model' is implemented by the sqlite database. It is static. The 'controller' directory stores the application logic for each freevo category. It is composed of ordinary python file. Perhaps, it would be better to change these into python modules. For the time being, single files are used. For example, the tv section has a file named 'tv.py', and the music section has a file named 'music.py.' Each of these files has a matching directory in the 'view' directory. Within each directory lives a file that matches the defined functions from the controller file. So, the controller 'music.py' defines a function named 'list.' As a result, there is a file named 'list.pyxml' in the 'view/music' directory. The list.pyxml is a mixed mode xml/python file that defines the presentation. The XML is compatible with kaa.canvas. The python code is found within <script> tags (for now). The engine code starts by evaluating the controller and saves any defined variables. The variables are used later within the view. Next, all of the script tags are extracted from the 'pyxml' file. These code chunklets are evaluated with the controller variables defined in the global namespace. I still need to come up with a method to define what should be printed back into the xml. Rails uses the moniker '<%=' instead of '<%' to represent regular code. After the code is evaluated, the output is mixed into the normal xml. The results are passed to kaa.canvas and rendered. test.py is the test theme engine. It is really dumb. It uses the built-in sax xml parser to find the script chunks. It uses regular expressions to replace the <script> tags with the evaluated equivalent. Evaluation is accomplished with the python builtin's 'compile' and 'eval.' Evaluate test.py to see the prototype in action. PROBLEMS Python does not work as well as Ruby because of the indenting. How to mark the end of a for loop with embedded XML? This is a big problem, and could make this solution a non-starter from the beginning. How to deal with supporting images? comments? -- Daniel C. Casimiro <[EMAIL PROTECTED]> ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel