On Dec 15, 2007 2:10 PM, Shchupak, Vitaliy <<a href="mailto:Vitaliy.Shchupak@deshaw.com">Vitaliy.Shchupak@deshaw.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">You could use RequestCLI to execute the Include macro in
another request using something like this:</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">from MoinMoin.request import RequestCLI</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">from MoinMion.user import User</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">from MoinMoin.formatter.text_html import
Formatter</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">def execute(macro, args):</font></span></div>
<div dir="ltr" align="left"><span> <font color="#0000ff" face="Arial" size="2"># <extract wikiname from
args></font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"> </font></span><span><font color="#0000ff" face="Arial" size="2">subreq =
RequestCLI('localhost/' + wikiname)</font></span></div>
<div dir="ltr" align="left"><span> <font color="#0000ff" face="Arial" size="2">subreq.user = user.User(subreq,
name=<a href="http://macro.request.user.name" target="_blank">macro.request.user.name</a>)</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"> formatter =
Formatter(subreq)<br> subreq.formatter =
formatter<br></font></span><span><font color="#0000ff" face="Arial" size="2"> # now call the Include macro from here
on subreq...</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"> ...</font></span></div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2"></font></span> </div>
<div dir="ltr" align="left"><span><font color="#0000ff" face="Arial" size="2">Vitaliy</font></span></div><br></div></blockquote></div><br>Thanks! That's too easy! I'm working on 1.6+1.7 code, so I had to use request_cli.Request, but otherwise I just inserted the above into the Request macro. Now comes something a little trickier - I need to rewrite the links. I know I can do this the dirty way (by parsing the html output from the macro), but I'd like a cleaner solution, and I'm a little confused whats getting formatted where?
<br><br>The links come out formatted for the current wiki, but the css class="nonexistent" is set from the included wiki. In the end I think I want to rewrite the links as interwiki links pointing to the same page as was originally intended, but currently I just don't want valid-looking links pointing to nonexistent pages.
<br><br>Thanks<br>-jim<br><br><br><br><br>