Re: [Rest2web-develop] New in SVN: Information about the current page (url, source and target filep
Brought to you by:
mjfoord
From: Michael F. <fuz...@vo...> - 2006-08-06 14:50:55
|
Gael Varoquaux wrote: >> These add to the namespace, *and* to pages in the indextree, various >> pieces of information about the pages : >> > > > >> 'source_file': The source file for the page >> > > >> 'current_dir': The current directory being processed - this can be >> turned into an absolute filepath by doing os.path.join(os.getcwd(), >> current_dir) >> > > >> 'target_dir': The target file directory (as an absolute file path) being >> rendered into. Note if the file has a target specified it may not be put >> 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 ! > > Hello Gael, > 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. > > The code that executes templates uses a single namespace. If you modify that namespace (create variables etc) then they should persist for that whole page - in the order that they are created in the page. *However*, up until about five minutes ago eval was done before exec. That meant that you couldn't do : <# xyz = 3 #> <% xyz %> (<% .. %> was always done first.) I've just reversed the order - so that should work now. > This would be really useful and would allow to avoid to much code > duplication in "template.txt" and in the different files processed. > > By the way Gael: You may find the journal/blog style parts of your site easier to administer with `Firedrop2 <http://www.voidspace.org.uk/python/firedrop2/>`_. You can still make entries with ReST - but it handles archives/RSS/categories etc for you, and lets you administer each entry separately. Just a thought. :-) Fuzzyman http://www.voidspace.org.uk/python/index.shtml > Cheers, > > Gaël > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Rest2web-develop mailing list > Res...@li... > https://lists.sourceforge.net/lists/listinfo/rest2web-develop > > |