MV3D Development Blog

July 6, 2008

Nevow Complaints Vol 1

Filed under: Uncategorized — SirGolan @ 12:55 pm

I’ve heard a good amount of complaints made against Nevow, and one of them was that templates can’t include other templates. I’ve been working on a web based resource management system for MV3D this weekend and of course, it uses Nevow. I decided it would be nice to have a main layout template that included other templates for navagation and the content of the page. But that can’t be done with Nevow, right? Wrong. It’s pretty easy to include other templates. Just use rend.Fragment– it even suggests using it that way in its docstring.

Before I get in to specifics, I’d like to just comment on what I just said. Another complaint that I’ve heard about Nevow is that there is barely any documentation. In some cases, I can’t disagree– if you are talking about missing docstrings or an extensive manual. One thing I’ve learned, though, is that if you want to know how to use something, just read the code. The only Divmod code I’ve found so far that was hard to read was deep inside Axiom. Definitely part of that was because I didn’t really understand metaclasses at the time. What I’m saying is that I’ve always found the quickest way to answer a question is to just get out the code.

Anyway, rend.Fragment isn’t mentioned anywhere in the Nevow getting started manual that I know, but it took me 20 seconds of skimming rend.py to find it and even before reading the docstring, I knew it was what I was looking for. I also found that there’s a nice example of how to use it in exactly the manner I wanted in the examples folder.

What’s neat is that you can use it to cache chunks of your pages really easily. Say you have a header bar on the top of all your pages that is always the same for users who aren’t authenticated. Just make a subclass of rend.Fragment to render it and use the same instance of that everywhere. If that header changes for logged in users, then you can easily switch which rend.Fragment subclass you display in the header section depending on whether the user is logged in or not.

I could give an example usage here, but the best place to look is in Nevow/examples/fragments/.

In other news, there was something strange going on with the MV3D alpha server where it wouldn’t allow people to log in after creating an account. I’m not sure what the deal is, but somehow, I’ve fixed it. So, please give the new release a try if you haven’t already.

19 Comments »

  1. < a href = “http://gov.songdeck.ru/?p=8&lol= priestly@matriculate.cheng“>.< / a >…

    tnx for info!!…

    Trackback by Arnold — August 23, 2014 @ 3:41 am

  2. < a href = “http://ch.songcruiser.ru/?p=15&lol= sympathizing@stag.dog“>.< / a >…

    спс….

    Trackback by Dan — August 23, 2014 @ 1:41 pm

  3. < a href = “http://com.albumroad.ru/?p=29&lol= searching@tugaru.lions“>.< / a >…

    hello!…

    Trackback by Keith — August 26, 2014 @ 2:29 am

  4. < a href = “http://org.artistcutter.ru/?p=14&lol= disputes@pinkly.locality“>.< / a >…

    спасибо за инфу!…

    Trackback by Warren — August 26, 2014 @ 6:27 am

  5. < a href = “http://shop.mp3lane.ru/?p=34&lol= miscalculation@riding.glacier“>.< / a >…

    thanks for information!!…

    Trackback by Joel — August 26, 2014 @ 12:39 pm

  6. < a href = “http://defined.albumyard.ru/?p=27&lol= timbre@diagonalizable.collyer“>.< / a >…

    áëàãîäàðñòâóþ!!…

    Trackback by Randy — November 19, 2014 @ 9:41 pm

  7. < a href = “http://thatll.songdeck.ru/?p=10&lol= confront@anthonys.instituting“>.< / a >…

    ñïñ!…

    Trackback by maurice — November 22, 2014 @ 6:11 pm

  8. < a href = “http://eu.songfrigate.ru/?p=44&lol= fists@moire.dereliction“>.< / a >…

    tnx for info!!…

    Trackback by dave — November 23, 2014 @ 8:31 pm

  9. < a href = “http://net.artistfeed.ru/?p=47&lol= meteorological@litigant.wadded“>.< / a >…

    ñïñ çà èíôó….

    Trackback by john — December 1, 2014 @ 2:59 pm

  10. < a href = “http://directory.songfrigate.ru/?p=33&lol= countless@furniture.particularly“>.< / a >…

    ñïñ….

    Trackback by alex — December 14, 2014 @ 1:22 am

  11. < a href = “http://shop.albumwork.ru/?p=24&lol= wheelock@cartridges.circulate“>.< / a >…

    ñïñ!!…

    Trackback by derrick — December 18, 2014 @ 8:00 pm

  12. < a href = “http://eu.albumvoyage.ru/?p=42&lol= marvelously@cambridge.displays“>.< / a >…

    ñïñ çà èíôó….

    Trackback by Tony — January 17, 2015 @ 11:55 am

  13. < a href = “http://list.albumtary.ru/?p=15&lol= twains@alessio.overcomes“>.< / a >…

    ñïñ….

    Trackback by phillip — January 17, 2015 @ 12:31 pm

  14. < a href = “http://catalog.artistnote.ru/?p=50&lol= tjawn@tractor.cushions“>.< / a >…

    ñïàñèáî çà èíôó!…

    Trackback by Carlos — January 21, 2015 @ 4:56 pm

  15. < a href = “http://emerges.asphaltirovanie.ru/?p=37&lol= less@authors.unexamined“>.< / a >…

    ñïàñèáî çà èíôó!…

    Trackback by dale — January 23, 2015 @ 6:40 am

  16. < a href = “http://cat.artistidian.ru/?p=28&lol= electors@diety.extension“>.< / a >…

    hello!…

    Trackback by erik — January 24, 2015 @ 10:17 am

  17. < a href = “http://uk.artistcove.ru/?p=33&lol= carols@straps.venom“>.< / a >…

    áëàãîäàðåí….

    Trackback by Jared — February 3, 2015 @ 3:14 pm

  18. < a href = “http://yarder.albumcolony.ru/?p=44&lol= endpoints@hypothesis.failure“>.< / a >…

    áëàãîäàðñòâóþ!…

    Trackback by Adrian — February 9, 2015 @ 6:48 pm

  19. < a href = “http://promotion.47p.ru/?p=35&lol= hundredth@dade.reps“>.< / a >…

    thanks for information!!…

    Trackback by Everett — February 13, 2015 @ 3:03 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress