Re: [Rest2web-develop] New in SVN: Information about the current page (url, source and target filep
Brought to you by:
mjfoord
From: Gael V. <gae...@no...> - 2006-08-06 13:39:17
|
> These add to the namespace, *and* to pages in the indextree, various=20 > pieces of information about the pages : > 'source_file': The source file for the page > 'current_dir': The current directory being processed - this can be=20 > turned into an absolute filepath by doing os.path.join(os.getcwd(),=20 > current_dir) > 'target_dir': The target file directory (as an absolute file path) bein= g=20 > rendered into. Note if the file has a target specified it may not be pu= t=20 > in this directory. Use os.path.dirname(target_file) instead. > 'full_page_url': The full url (starting with '/') for the current page > 'target_file': The full filename of the page being rendered Now that _is_ useful ! Can I suggest another change : for each page, variables created in one code block are kept and accessible for the next code blocks. You can have a look at what I do in pyreport ( http://gael-varoquaux.info/computers/pyreport ) to see how I do something similar. Check out the function executeBlock: I save the namespace at the end of the function call and reinject it later in my "exec" call. This would be really useful and would allow to avoid to much code duplication in "template.txt" and in the different files processed. Cheers, Ga=EBl |