i would like to be able to create a Menu item which links to an absolute URL of another CGI script on the server, which script is given as an argument the name of the page on which this Menu item was clicked.
i've written a GraphViz visualiser for the link relationships between the pages in my wiki and i would like to be able to access that visualiser from any page and have the page concerned and its link neighbourhood highlighted in the graph so produced. (my visualiser can already do all this if given the page from which it was called.)
for example, suppose my wiki is accessible from a CGI script using
http://www.example.com/cgi/wiki.cgi (this is an adaptation of your hattarun.py)
i would like to be able to set up a Menu item which accesses
http://www.example.com/cgi/grviz.cgi?Foo
when clicked from page Foo in the wiki.
if you could provide this feature i would be very grateful.
great product btw.
-RogerMateer
I'm glad you use and like Hatta. I do plan to introduce InterWiki links, aka URL aliases (you might have even noticed a config variable for it already and wondered what it's for), but it goes slowly. What InterWiki does is letting you specify aliases for parts of addresses, so that if you specify that "Grviz" is an alias for http://www.example.com/cgi/grviz.cgi?, then you can write [[Grviz:Foo]] to link to http://www.example.com/cgi/grviz.cgi?Foo. I suppose this is not exactly what you want, because you also want the page name filled automatically with the name of the currently displayed page… I'm not sure such a feature would be useful enough to include in Hatta by default, but you can add it by using a wrapper over the wiki:
import hatta
import werkzeug
class MyWiki(hatta.Wiki):
def html_page(self, request, title, content, page_title=u''):
for part in hatta.Wiki.html_page(self, request, title, content, page_title):
if part == u'</div></body></html>':
yield u'<a href="http://example.com/grviz.cgi?%s">Graph</a> ' % werkzeug.url_quote(title)
yield part
and then instantiate MyWiki instead of hatta.Wiki. I know this is hackish, I will try to break the html_page method up to make this kind of override easier in the future. – Radomir Dopieralski