[typo] Cleanups for 4.1

Scott Laird scott at sigkill.org
Tue Aug 15 11:41:46 EDT 2006

On 8/15/06, Piers Cawley <pdcawley at bofh.org.uk> wrote:
> "Scott Laird" <scott at sigkill.org> writes:
> > On 8/15/06, Piers Cawley <pdcawley at bofh.org.uk> wrote:
> >> "Scott Laird" <scott at sigkill.org> writes:
> >>
> >> > 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.
> >>
> >> Okay, the sooner we get this into trunk (and a 4.0.x release for that
> >> matter) with the 'removed in 4.1' helpers dropping deprecation
> >> warnings into the logs the better. We don't have to make the changes
> >> yet, we *do* have to warn as early and widely as possible if we're
> >> going to go changing public interfaces.
> >>
> >> (Not something we've been desperately good at I admit)
> >
> > Yeah.  My goal is to get 4.0.3 out tomorrow or Thursday, and then
> > branch 4.0.x.  I'll merge my code as soon as possible after that.
> Yay!

I know that Rails 1.2 will come with a deprecation system, but I don't
want to wait, and I had a couple special things that I wanted to do,
anyway, so I whipped one up just now.  You flag deprecation like this:

  def foo_helper(arg)
    typo_deprecated("Replaced with Article#foo")

Under normal circumstances, it logs deprecation warnings to the log.
The warnings look like this:

  Deprecation warning: foo_helper called from
app/models/content.rb:31:in `initialize'  Replaced with Article#foo

Each deprecation line is only logged once; after that they're silently
ignored, *EXCEPT* in test mode--when RAILS_ENV==test, deprecations
throw exceptions every time.  This should make them harder to ignore


More information about the Typo-list mailing list