Folks,

I'm making a stab at updating the "Widget" theme for 1.9, and would like 
your assistance.

There is only really one issue I've found so far - the original v1.6 
theme used RequestCLI to fetch some additional content, and in 1.9 this 
has gone away. I have the following patch which may be suitable, but I'm 
really guessing and know almost nothing about the calls involved. Could 
you let me know if it seems ok? As the comment suggests the original 
code reused some _tests code, and I have gone back to that code for an 
updated version.
   [ /usr/share/moin-1.9.3/MoinMoin/parser/_tests/test_text_moin_wiki.py ]

Many thanks,
Ruth

Here is the patch:

*** widget.py   2006-05-14 23:02:25.000000000 +0100
--- widget-1.9.py       2011-05-15 22:58:08.482823109 +0100
***************
*** 197,225 ****
           if targetPage.isStandardPage(includeDeleted=False):
               # Option 1: It's a page
               unformattedPage = targetPage.get_raw_body()
               if preformattedRegExp.search(unformattedPage):
                   # Option 1a: It's preformatted
                   menuHtml = re.search(preformattedRegExp, 
unformattedPage).groups()[0]
               else:
                   # Option 1b: It's wikiformatted
-                 formattedwiki = StringIO()
                   # The following is copied from 
MoinMoin._tests.test_parser_wiki
!                 request = RequestCLI()
!                 request.redirect(formattedwiki)
!                 page = Page(self.request, 
'ThisPageDoesNotExistsAndWillNeverBeReally')
!                 page.set_raw_body(unformattedPage)
!                 from MoinMoin.formatter.text_html import Formatter
!                 page.formatter = Formatter(request)
!                 request.formatter = page.formatter
!                 page.formatter.setPage(page)
!
!                 Parser(unformattedPage, request).format(page.formatter)
!                 menuHtml = formattedwiki.getvalue()
           else:
               # Option 2: It's an attachment
               filePath = 
AttachFile.getFilename(self.request,rootPage,dataPage)
               try:
                fileHandle = open(filePath)
                try:
                 menuHtml = fileHandle.read()
                finally:
--- 197,226 ----
           if targetPage.isStandardPage(includeDeleted=False):
               # Option 1: It's a page
               unformattedPage = targetPage.get_raw_body()
               if preformattedRegExp.search(unformattedPage):
                   # Option 1a: It's preformatted
                   menuHtml = re.search(preformattedRegExp, 
unformattedPage).groups()[0]
               else:
                   # Option 1b: It's wikiformatted
                   # The following is copied from 
MoinMoin._tests.test_parser_wiki
!                 request = self.request
!                 request.reset()
!                 page = Page(request, 
u'ThisPageDoesNotExistsAndWillNeverBeReally')
!                 page.hilite_re = None
!                 page.set_raw_body(body)
!                 formatter = HtmlFormatter(request)
!                 formatter.setPage(page)
!                 page.formatter = formatter
!                 request.formatter = formatter
!                 parser = WikiParser(body, request, line_anchors=False)
!                 formatter.startContent('') # needed for _include_stack 
init
!                 menuHtml = request.redirectedOutput(parser.format, 
formatter)
!                 formatter.endContent('')
           else:
               # Option 2: It's an attachment
               filePath = 
AttachFile.getFilename(self.request,rootPage,dataPage)
               try:
                fileHandle = open(filePath)
                try:
                 menuHtml = fileHandle.read()
                finally:



-- 
Software Manager&  Engineer
Tel: 01223 414180
Blog: http://www.ivimey.org/blog
LinkedIn: http://uk.linkedin.com/in/ruthivimeycook/



------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Moin-user mailing list
Moin-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/moin-user

Reply via email to