Home
entries friends calendar user info Scribbles in the Dark Previous Previous
Hali Boat Party
stranger than the night where black stars rise
[info]sirgolan
Add to Memories
Tell a Friend
Nevow Complaints Vol 1
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.

Tags: , ,

crackmonkey
[info]crackmonkey
Add to Memories
Tell a Friend
Stew Update
z3p
[info]z3p
Add to Memories
Tell a Friend
SimplyNoise.com - The best free white noise generator on the Internet.
SimplyNoise.com - The best free white noise generator on the Internet. Pretty simple Flash application which generates white noise right from your browser. Personally I like it at about 60%.

(Original entry: http://z3p.tumblr.com/post/41113624)
gothfru
[info]gothfru
Add to Memories
Tell a Friend
right, then!
Apparently rebooting my phone solved the sound problem. Phone now works; still upgrading on the 11th ;)
redstapler
[info]redstapler
Add to Memories
Tell a Friend
D:
Joey Chestnut won in overtime. :(
redstapler
[info]redstapler
Add to Memories
Tell a Friend
OH MY GODS
IT'S A TIE! OVERTIME OMFG!
redstapler
[info]redstapler
Add to Memories
Tell a Friend
::FLAIL::
I can't see anything, but poor Kobayashi is behind. :(

Stupid Joey Chestnut and his four-dog lead!

Edit 1: TIED

Edit 2: Kobayashi is ahead 1.5 hot dogs!!

Edit 3: Two hot dog lead!

Edit 4: OMFG IS IT A TIE?!?!?
redstapler
[info]redstapler
Add to Memories
Tell a Friend
Live Blogging the Madness
A couple just got engaged on stage. The Emcee knew it was going to happen. In preparation earlier this week, he registered in the Universal Life Church. So they also just got married.

LOL WHUT.

Also: I'm still a Kobayashi girl, but I'm giving serious thought to Double-Oh-Kevin.
redstapler
[info]redstapler
Add to Memories
Tell a Friend
ALL THE WAY TO CONEY
I'm at the hot dog eating contest.

GO KOBAYASHI!!!
gothfru
[info]gothfru
Add to Memories
Tell a Friend
PSA
My cell phone is no longer working. It will be fixed on or after the 11th ;)
profile
Glyph Lefkowitz
User: [info]glyf
Name: Glyph Lefkowitz
calendar
Back April 2008
12345
6789101112
13141516171819
20212223242526
27282930
page summary
tags