[typo] Email notification of comments

Pascal Belloncle psq at nanorails.com
Thu Aug 17 23:07:13 EDT 2006


In typo 4.0.2, neither email or trackbacks work for me.  Well, they don't
work using webrick, and they very rarely work using fcgi.  I have tracked it
down to a problem in rails and the Dispatch code.  Basically, observers are
not restored correctly after Dispatcher::reset_application!  Depending on
your setup (lighttpd, webrick, fcgi) and how it uses the dispatcher, you may
or may not be affected since the first time your go through the dispatcher,
everything works fine, but the subsequent times, the observers are gone, so
no email or no trackbacks.  If you are lucky to get a new ruby instance, it
works.

The way to workaround this is to setup your observers in
ApplicationController instead of environment.rb adding this line to the
app/controllers/application.rb:

 observer :content_observer, :email_notifier, :web_notifier

I'm still testing the patch before I use it on my site and I'm guessing
that's probably an oversight from the rails code, but the workaround seems
to work for me.

Pascal
http://blog.nanorails.com

On 8/17/06, Trejkaz <trejkaz at trypticon.org> wrote:
>
> > Fun :-(.  Well, email notifications work for me.  If you can find a
> > fix then I'll roll it up into 4.0.4.
>
> Okay, I just did a web request and a console request and snipped the state
> changes out of the logs of both for the purpose of comparison.
>
> Here's what happens during a web request:
>
> #<Comment:0xb6ef4fd0> leaving state ContentState::New
> #<Comment:0xb6ef4fd0> entering state ContentState::Unclassified
> #<Comment:0xb6ef61a0> leaving state ContentState::New
> #<Comment:0xb6ef61a0> entering state ContentState::Published
> #<Comment:0xb6ef61a0> leaving state ContentState::Published
> #<Comment:0xb6ef61a0> entering state ContentState::Unclassified
> #<Comment:0xb6ef61a0> leaving state ContentState::Unclassified
> #<Comment:0xb6ef61a0> entering state Content::JustPresumedHam
> #<Comment:0xb6ef61a0> leaving state Content::JustPresumedHam
> #<Comment:0xb6ef61a0> entering state ContentState::PresumedHam
>
> And here's a comment sent manually through the console:
>
> #<Comment:0xb7579d40> leaving state ContentState::New
> #<Comment:0xb7579d40> entering state ContentState::Unclassified
> #<Comment:0xb7596a58> leaving state ContentState::New
> #<Comment:0xb7596a58> entering state ContentState::Unclassified
> #<Comment:0xb7596a58> leaving state ContentState::Unclassified
> #<Comment:0xb7596a58> entering state Content::JustPresumedHam
> (NOTIFICATIONS BEING SENT HERE)
> #<Comment:0xb7596a58> leaving state Content::JustPresumedHam
> #<Comment:0xb7596a58> entering state ContentState::PresumedHam
>
> What's most interesting to me is how the console version never becomes
> "published", and yet it's the only one where the notifications are sent.
>
> TX
>
>
> _______________________________________________
> Typo-list mailing list
> Typo-list at rubyforge.org
> http://rubyforge.org/mailman/listinfo/typo-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/typo-list/attachments/20060817/57eb5d39/attachment.html 


More information about the Typo-list mailing list