Hi Ron,

Yes I read both pages a while ago, unfortunately I'm too green to
Pylons as well as to Python
to appreciate the terse message there. E.g., something like "so you
will also need to create
a __init__.py file inside appname/templates" didn't help me at all as
I don't even know what is
to be placed in the __init__.py file there. That's why I am dying for
a _working_ Pylons+Genshi
example project.

As another example, I am exercising translating the cheeseshop
quickwiki tutorial to use Genshi,
but couldn't get it right. my controllers/page.py snippet looks --

    def index(self, title):
        page = model.Page.get_by(title=title)
        if page:
            c.content = page.get_wiki_content()
            loader = TemplateLoader(['templates'])
            tmpl = loader.load('page.html')
            stream = tmpl.generate(title='Hello, world!')
            return stream.render('xhtml')
        elif model.wikiwords.match(title):
            return render_response('/new_page.html')
        abort(404)

and the corresponding templates/page.html --

<html xmlns="http://www.w3.org/1999/xhtml";
      xmlns:py="http://genshi.edgewall.org/";
      lang="en">
<h1 class="main">${c.title}</h1>
${c.content}

<py:if test="c.message">
<p><div id="message">${c.message}></div></p>
</py:if>

Gives me a "Template "page.html" not found" error. Obviously the
TemplateLoader
statement is in error, but how should it be? How should the other
stuff be? I don't
know without a guide, how long it will take me just to reach the point
of knowing
what I am doing...

--
Cheers,
Jerry

On 2 Apr, 10:50, "Ron Bickers" <[EMAIL PROTECTED]> wrote:
> On Apr 1, 8:17 am, "jerryji" <[EMAIL PROTECTED]> wrote:
>
> > I'm stuck -- can't even get started with Pylons+Genshi.
>
> Did you look at Using Genshi with Pylons in the Wiki? (http://
> pylonshq.com/project/pylonshq/wiki/GenshiWithPylons)
>
> It works fine, but there are at least two important details not there
> that I had to figure out.  I'm new to Pylons, so I'm not sure if
> there's more to it.
>
> 1) You have to add an __init__.py in the templates directory.  This is
> mentioned in the Genshi site howto 
> athttp://genshi.edgewall.org/wiki/GenshiRecipes/PylonsWithGenshi,
> but not in the one on the Pylons site.
>
> 2) The reference to the template files is not the same as it is with
> Myghty.  Genshi template filenames must end with .html and you refer
> to them without the .html ending.  Eg:
>
>   render_response('mytemplate') refers to <app>/templates/
> mytemplate.html
>
>   render_response('othertemplates.mytemplate') refers to <app>/
> templates/othertemplates/mytemplate.html
>
> >From reading some of the source changlog, I *think* that's going to
>
> change so that they can be referenced in a path-like way the same as
> Myghty templates.  Genshi support appears to be pretty young, but it
> does work.
>
> Hope this helps.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to