Re: Problem with embedded Python code blocks

Chris G <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <[email protected]>
On Thu, Sep 06, 2007 at 06:22:07PM -0400, Will Guaraldi wrote:
> The embedded python blocks are a feature of my plugins--they're not
> something that works in the PyBlosxom core template system.  So this
> would only work for pages being served by wbgwiki, pystaticfile, and
> pyinclude.
> 
> Do the examples in the wbgwiki documentation work?
> 
As far as I can tell only single line embedded code works.

E.g. I have created a file called wikiTxt.txt in my wiki hierarchy
which contains:-




    WikiTest
        
     
    <%
    print "testing" 
    %>
     
    <%   
        x = { "apple": 5, "banana": 6, "pear": 4 }  
        for mem in x.keys():     
            print "<li>%s - %s</li>" % (mem, x[mem])       
    %>



... and the output in my browser is:-


    WikiTest

    testing ERROR in processing: unexpected indent (, line 2)
    [ category: /wiki | Permalink ]


I.e. the single line print works but the multi-line assignment plus
for loops fails.  This seems to agree with what I was seeing before,
single line bits of embedded python work but anything multi-line just
causes confusion.


If I rename the same file to wikiRst.rst so it gets parsed by the
reStructured text parser then I see the following in my browser:-

    WikiTest

    <% print "testing" %>

    <%

        x = { "apple": 5, "banana": 6, "pear": 4 } for mem in x.keys():

        System Message: ERROR/3 (<string>, line 10)
        Unexpected indentation.

            print "<li>%s - %s</li>" % (mem, x[mem])

    System Message: WARNING/2 (<string>, line 11)
    Definition list ends without a blank line; unexpected unindent.

    %>
    [ category: /wiki | Permalink ]


Strangely if I put the same (wikiRst.rst) file into my blog directory
it gets parsed exactly as above, i.e. something attempts to parse the
embedded python code even though it's in my blog directory.

The only plugins I am running are wgbwiki.py (obviously!),
filekicker.py and rst.py.

-- 
Chris Green

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.