[typo] Cleanups for 4.1
scott at sigkill.org
Mon Aug 14 13:21:03 EDT 2006
I've been working on some cleanups for 4.1 in a branch, and I wanted
to give a heads-up here, so people can scream in terror before I
commit it :-).
The first change is that blog.url_for now uses
blog.canonical_server_url. This means that we don't need a controller
to generate URLs any more. Which leads to...
- a complete removal of the wacky before/after filter that saves the
- a complete removal of the controller parameter for all of the text
- a complete removal of the controller parameter for notifications.
- text filters stop being controllers.
So, a lot of ugly code goes away.
Next, I cleaned up a bunch of helper code. We had at *least* 8 copies
of the article permalink generation code, and a pile of redundant ways
to do almost everything. So I cleaned up all of it, but this will
break out-of-tree themes, filters, and sidebars.
First, I added a 'permalink_url' method of all of the model classes
that have permalinks. Since it uses blog.url_for, it's static and
doesn't depend on any controller code. I then *removed* all of the
other permalink generation code--article.location, article_url,
blog.url_for(article), and a handful of other localized helpers are
all gone. The entire codebase uses article.permalink_url now. I'm
working on adding edit_url, delete_url, and feed_url; once those are
done about 90% of the url_fors in the main body of Typo will
disappear. Since the new URL code is a lot faster then the old code
(caching, mostly), this should help performance a bit. And more
importantly, it's a lot cleaner.
I've also removed a bunch of other helpers--I'll post a list later,
but I'm trying to get rid of redundant and outdated helpers. In
general, I'm planning on keeping the most direct mechanism and getting
rid of the rest. For instance, it's now safe to get rid of
article_html/coment_html/page_html and simply use article.html and
I'm not done yet, but the code is looking *much* cleaner and more
direct. I'm removing more code then I'm adding, which is almost
always a good thing.
The downside of this is that I've probably broken most themes. The
changes needed will be pretty trivial, but changes will be needed.
This is for 4.1, not 4.0--it won't be released for months, so we'll
have time to clean up themes. This probably won't be the last
incompatible theme/sidebar/text filter change for 4.1, but we'll have
some good things that will make up for it soon--trust us :-).
More information about the Typo-list