[Zope] Constructing 'Friendly' URLs in products

Phillip Hutchings sitharus at gmail.com
Wed Dec 1 21:52:02 EST 2004


Hi,

I'm fairly new to Zope, so if it's a obvious answer don't kill me ;)

I've been considering setting up a blog in Zope. I used to use
Wordpress in PHP before I decided to give Zope a try, and I'm actually
liking it so far.

Anyway, I've looked at coreblog, but it gives URLs like /blog/12 and
/blog/1234, I'm really looking for things like
/blog/2004/11/04/wow-zope-is-cool, like Wordpress manages with the aid
of mod_rewrite.

Now, I guess I could do somthing like
/blogposts?year=2004&month=11&day=04&title=wow-zope-is-cool through
mod_rewrite, but I was wondering if there was a more zope-centric
solution? About the best I could come up with was chaining a series of
persistant classes which subclass Item.Folder (iirc that's the one),
sort of like this:
Blog->BlogYear(id=2004)->BlogMonth(id=11)->BlogDay(id=04)->BlogPost(id=wow-zope-is-cool),
just a containment hierarchy. Is this good or bad thinking? I was also
thinking of a single class that used something like __getattr__ to
process a function or something, but I haven't though of how that
would work. Probably like this myPosts =
{'2004':{'11':{'04':{'wow-zope-is-cool':getBlogPost}}}}, but I'm not
sure if that would even work.

Comments? Suggestions?

-- 
Phillip Hutchings
http://www.sitharus.com/
sitharus at gmail.com / sitharus at sitharus.com


More information about the Zope mailing list