[Moin-user] interwiki include macro

Shchupak, Vitaliy Vitaliy.Shchupak at deshaw.com
Sun Dec 16 01:40:21 EST 2007


Try initializing the request with:
subreq = RequestCLI('localhost/' + wikiname,
properties={'script_name':'/'+wikiname})
(may need to me adjusted for 1.6+)
 
Vitaliy



________________________________

	From: jbardin.bu at gmail.com [mailto:jbardin.bu at gmail.com] On
Behalf Of james bardin
	Sent: Sunday, December 16, 2007 1:00 AM
	To: Shchupak, Vitaliy
	Cc: moin-user at lists.sourceforge.net
	Subject: Re: [Moin-user] interwiki include macro
	
	
	On Dec 15, 2007 2:10 PM, Shchupak, Vitaliy
<Vitaliy.Shchupak at deshaw.com> wrote:
	

		You could use RequestCLI to execute the Include macro in
another request using something like this:
		 
		from MoinMoin.request import RequestCLI
		from MoinMion.user import User
		from MoinMoin.formatter.text_html import Formatter
		def execute(macro, args):
		    # <extract wikiname from args>
		    subreq = RequestCLI('localhost/' + wikiname)
		    subreq.user = user.User(subreq,
name=macro.request.user.name)
		    formatter = Formatter(subreq)
		    subreq.formatter = formatter
		    # now call the Include macro from here on subreq...
		    ...
		 
		Vitaliy



	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? 
	
	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. 
	
	Thanks
	-jim
	
	
	
	
	

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/moin-user/attachments/20071216/b3ffcece/attachment.html>


More information about the Moin-user mailing list