[Twisted-web] Nested Nevow templates

orbitz orbitz at ezabel.com
Thu Nov 4 15:09:35 MST 2004


Render methods can return rend.Page's. so

def render_nested(self, context, data):
    return Mypage()

If you want to pass data then just do
<nevow:data="whatever" nevow:render="nested"/>

Then define data_whatever to put some data on the stack and 
render_whatever to take the data and pass it ot yoru page constructor


Erik Swan wrote:

> Everyone,
>
> I'm somewhat new to Nevow and have a simple question - btw, it maybe 
> already possible and i missed the man page...
>
> We mostly use HTML based templates to drive our presentations as we 
> have an html designer that can design and maintain a large majority of 
> the UI without knowledge of any coding.  The designer delivers html 
> that can be rendered on its own for review but also adds in 
> directives, patterns and slots to make the programmers life easier.
>
> My question centers around the best way to have nested templates - 
> that is i'd like a directive that would function as an include and all 
> the appropriate Nevow render code get executed automatically. That way 
> our designer can build a header, footer, sidebars, and other html 
> components as separate files and the main template just "includes" as 
> appropriate.  Something like
>  <nevow:include name="blah.html">
>
> Additionally, and here is my Nevow ignorance, there must be a simple 
> few lines of code that does the equivalent in code for example if i had:
>  <nevow:render name = templateName>
>
> then in...
>  def render_templateName(self, context, data):
>      #load and render file templateName as include and return result
>
> Lastly, if the above method works OK then I'd rather have
>  <nevow:render name=include nevow:arg=templateName>
> where i can have a generic include render method and take an argument 
> from the html tag.
>
> So, like i said, being new this maybe all be easy/possible and i just 
> missed it. Also, i've felt the wrath of mvc and proper separation of 
> code from html for almost 10 years now and i understand how the above 
> is in violation ;-)
>
> Thanks in advance for any help.
> Cheers,
> e.
>
>
>
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
>




More information about the Twisted-web mailing list