Forum: Typo jabber_notify.rb error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
George S. (Guest)
on 2006-04-12 23:52
(Received via mailing list)
I keep getting this error. Any ideas as to why this is happening? I
am running r977 (don't have time to update).

================================
NameError in Admin/content#new

undefined local variable or method `logger' for JabberNotify:Class

RAILS_ROOT: /home/sudarkoff/sites/typo
Application Trace | Framework Trace | Full Trace

#{RAILS_ROOT}/lib/jabber_notify.rb:17:in `send_message'
#{RAILS_ROOT}/app/models/article.rb:140:in `send_notification_to_user'
#{RAILS_ROOT}/app/models/article.rb:130:in `send_notifications'
#{RAILS_ROOT}/app/models/article.rb:129:in `send_notifications'
#{RAILS_ROOT}/app/controllers/admin/content_controller.rb:98:in
`tidy_up_and_notify'
#{RAILS_ROOT}/app/controllers/admin/content_controller.rb:88:in
`new_or_edit'
#{RAILS_ROOT}/app/controllers/admin/content_controller.rb:22:in `new'

/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/base.rb:853:in `perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/filters.rb:332:in `perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/rescue.rb:82:in `perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/base.rb:369:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/session_management.rb:116:in `process'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:
141:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:
53:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:600:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:
52:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:
22:in `process!'
#{RAILS_ROOT}/public/dispatch.fcgi:24

#{RAILS_ROOT}/lib/jabber_notify.rb:17:in `send_message'
#{RAILS_ROOT}/app/models/article.rb:140:in `send_notification_to_user'
#{RAILS_ROOT}/app/models/article.rb:130:in `send_notifications'
#{RAILS_ROOT}/app/models/article.rb:129:in `send_notifications'
#{RAILS_ROOT}/app/controllers/admin/content_controller.rb:98:in
`tidy_up_and_notify'
#{RAILS_ROOT}/app/controllers/admin/content_controller.rb:88:in
`new_or_edit'
#{RAILS_ROOT}/app/controllers/admin/content_controller.rb:22:in `new'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/base.rb:853:in `perform_action_without_filters'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/filters.rb:332:in `perform_action_without_benchmark'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/benchmarking.rb:69:in `perform_action_without_rescue'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/rescue.rb:82:in `perform_action'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/base.rb:369:in
`process_without_session_management_support'
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.11.2/lib/
action_controller/session_management.rb:116:in `process'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/dispatcher.rb:38:in
`dispatch'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:
141:in `process_request'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:
53:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:600:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/fcgi-0.8.6.1/./fcgi.rb:597:in
`each_cgi'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:
52:in `process!'
/usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/lib/fcgi_handler.rb:
22:in `process!'
#{RAILS_ROOT}/public/dispatch.fcgi:24

Request

Parameters: {...}

Show session dump

---
:user: !ruby/object:User
   attributes:
     name: ************
     notify_via_jabber: "1"
     notify_via_email: "1"
     notify_watch_my_articles:
     id: "1"
     notify_on_comments: "1"
     jabber: ************
     login: ************
     password: ************
     email: ************
     notify_on_new_articles: "1"
   notify_contents:
flash: !map:ActionController::Flash::FlashHash {}

:return_to:

Response
Headers: {"cookie"=>[], "Cache-Control"=>"no-cache"}
================================
Piers C. (Guest)
on 2006-04-13 19:41
(Received via mailing list)
George S. <removed_email_address@domain.invalid> writes:

> I keep getting this error. Any ideas as to why this is happening? I
> am running r977 (don't have time to update).

Can someone please just dike the entire jabber notification subsystem
out? We'll start again from clean after 4.0. I'd do it myself, but I'm
stuck doing paing work at the moment.
Trejkaz (Guest)
on 2006-04-14 07:41
(Received via mailing list)
On Friday 14 April 2006 01:36, Piers C. wrote:
> George S. <removed_email_address@domain.invalid> writes:
> > I keep getting this error. Any ideas as to why this is happening? I
> > am running r977 (don't have time to update).
>
> Can someone please just dike the entire jabber notification subsystem
> out? We'll start again from clean after 4.0. I'd do it myself, but I'm
> stuck doing paing work at the moment.

Alternatively could someone commit my patch which makes it all work?
It's
been on the trac for quite some time now.

The main problem is that Typo went with Jabber4R, which is buggy.
Replace
that with XMPP4R, and everything works fine.

TX

P.S. If you're going to throw out Jabber notification, please throw out
     email notification too.  I only use the Jabber one, after all, and
     can't imagine why anyone would want to be notified via email. ;-p
Piers C. (Guest)
on 2006-04-14 08:35
(Received via mailing list)
Trejkaz <removed_email_address@domain.invalid> writes:

> been on the trac for quite some time now.
The main problem I have with the whole Jabber notification scheme is
that it's almost entirely test free. I prefer to view what's in place as
a
spike, throw it away and start again test first with the benefit of
extra understanding from the first, failed solution. As I've explained
in my blog[1], I'm not totally averse (but getting more averse by the
day) to committing changes without patches, but only when those
changes are 'mine' because then I've at least got a chance of
remembering my intent.

Which is why I haven't committed the big podcasting patch either --
It's screaming out for a couple or three integration or functional
tests to stand as an explanation of what the patch does. Without that,
I haven't the faintest idea if what the patch does is the right thing,
or just what it does. Show me tests and you show me what you intend.

> The main problem is that Typo went with Jabber4R, which is buggy.  Replace
> that with XMPP4R, and everything works fine.

I just checked, and there's a licensing problem with XMPP4R as well,
which means we can't include it in the Typo distribution without
changing Typo's license, which I'm not prepared to do. And I'm not
prepared to add an external dependency either.

Give me a patch, with tests, that degrades gracefully (it can simply
turn jabber notification off) if the absence of XMPP4R and I'll jump
at the chance to apply it. Until then, I'd far rather see it taken out
for 4.0 rather than ship broken code.

> P.S. If you're going to throw out Jabber notification, please throw
>      out email notification too.  I only use the Jabber one, after all,
>      and can't imagine why anyone would want to be notified via
>      email. ;-p

Meh! I just use the feed...
Piers C. (Guest)
on 2006-04-14 08:38
(Received via mailing list)
Piers C. <removed_email_address@domain.invalid> writes:
> extra understanding from the first, failed solution. As I've explained
> in my blog[1], I'm not totally averse (but getting more averse by

Oopsie. Forgot the footnote. Here it is:

1.
http://www.bofh.org.uk/articles/2006/03/12/if-you-...
Trejkaz (Guest)
on 2006-04-14 11:51
(Received via mailing list)
On Friday 14 April 2006 14:32, Piers C. wrote:
> I just checked, and there's a licensing problem with XMPP4R as well,
> which means we can't include it in the Typo distribution without
> changing Typo's license, which I'm not prepared to do. And I'm not
> prepared to add an external dependency either.

XMPP4R is released under the Ruby licence.  I take it that Typo, a
project
written in Ruby itself, is incompatible with the Ruby licence.  Nice bit
of
irony right there.

TX
Trejkaz (Guest)
on 2006-04-14 12:03
(Received via mailing list)
On Friday 14 April 2006 14:35, Piers C. wrote:
> Piers C. <removed_email_address@domain.invalid> writes:
> > extra understanding from the first, failed solution. As I've explained
> > in my blog[1], I'm not totally averse (but getting more averse by
>
> Oopsie. Forgot the footnote. Here it is:
>
> 1. http://www.bofh.org.uk/articles/2006/03/12/if-you-...

Just out of curiosity, how does one test a feature which by its very
nature
requires contact with a server somewhere?  Is there a common Jabber
server
which unit tests might be able to connect to, which would always be
present
in order to test something like Jabber notifications?

The same problem exists with mail notifications, naturally.

One might say that you can stub the thing which sends the mail.  But if
you
also stubbed the thing which sends the instant message, the existing
notification for Jabber would seem to be working, because the broken
code is
inside the method you would need to stub.

TX
Piers C. (Guest)
on 2006-04-14 18:10
(Received via mailing list)
Trejkaz <removed_email_address@domain.invalid> writes:

> On Friday 14 April 2006 14:32, Piers C. wrote:
>> I just checked, and there's a licensing problem with XMPP4R as well,
>> which means we can't include it in the Typo distribution without
>> changing Typo's license, which I'm not prepared to do. And I'm not
>> prepared to add an external dependency either.
>
> XMPP4R is released under the Ruby licence.  I take it that Typo, a project
> written in Ruby itself, is incompatible with the Ruby licence.  Nice bit of
> irony right there.

Ah... according to the RAA page I looked at, it was GPL
licensed. However, on further investigation I see you're right. Oops.
Trejkaz (Guest)
on 2006-04-14 18:34
(Received via mailing list)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 15/04/2006, at 00:08 AM, Piers C. wrote:

>> written in Ruby itself, is incompatible with the Ruby licence.
>> Nice bit of
>> irony right there.
>
> Ah... according to the RAA page I looked at, it was GPL
> licensed. However, on further investigation I see you're right. Oops.

Actually, on the subject of the GPL, what about bluecloth?  vendor/
bluecloth/LICENCE is GPL2.

TX

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (Darwin)

iD8DBQFEP7JCuMe8iwN+6nMRAhwCAJ4+ulXUOAE1sdVO2gLl41yMdBGbOQCfUIYG
th5LJ4PLzPVuGgEKBR+KkWY=
=vCm+
-----END PGP SIGNATURE-----
Scott L. (Guest)
on 2006-04-14 22:28
(Received via mailing list)
Er, then we have an old version.  The current one is BSD.

Scott
On 4/14/06, Trejkaz <removed_email_address@domain.invalid> wrote:> -----BEGIN 
PGP
SIGNED MESSAGE-----> Hash: SHA1>>> On 15/04/2006, at 00:08 AM, Piers
Cawley wrote:>> > Trejkaz <removed_email_address@domain.invalid> writes:> >> >> 
On
Friday 14 April 2006 14:32, Piers C. wrote:> >>> I just checked, and
there's a licensing problem with XMPP4R as well,> >>> which means we
can't include it in the Typo distribution without> >>> changing Typo's
license, which I'm not prepared to do. And I'm not> >>> prepared to add
an external dependency either.> >>> >> XMPP4R is released under the Ruby
licence.  I take it that Typo, a> >> project> >> written in Ruby itself,
is incompatible with the Ruby licence.> >> Nice bit of> >> irony right
there.> >> > Ah... according to the RAA page I looked at, it was GPL> >
licensed. However, on further investigation I see you're right. Oops.>>
Actually, on the subject of the GPL, what about bluecloth?  vendor/>
bluecloth/LICENCE is GPL2.>> TX>> -----BEGIN PGP SIGNATURE-----> Versi!
on: GnuPG v1.4.2.2 (Darwin)>>
iD8DBQFEP7JCuMe8iwN+6nMRAhwCAJ4+ulXUOAE1sdVO2gLl41yMdBGbOQCfUIYG>
th5LJ4PLzPVuGgEKBR+KkWY=> =vCm+> -----END PGP SIGNATURE----->
_______________________________________________> Typo-list mailing list>
removed_email_address@domain.invalid>
http://rubyforge.org/mailman/listinfo/typo-list>
Piers C. (Guest)
on 2006-04-14 22:55
(Received via mailing list)
Trejkaz <removed_email_address@domain.invalid> writes:

> requires contact with a server somewhere?  Is there a common Jabber server
> which unit tests might be able to connect to, which would always be present
> in order to test something like Jabber notifications?

Am I correct in remembering that Jabber's a peer to peer protocol?
Presumably you can just fire up a client object in some sort of accept
connections mode and use that as your jabber server.

I'd also suggest looking at how the XMPP4R tests themselves do
it. Essentially, you need to check that typo is sending the right
stuff to the library, so you might be able to get away with stubbing
the entire connection.

> The same problem exists with mail notifications, naturally.
>
> One might say that you can stub the thing which sends the mail.

That's pretty much what we do.

> But if you also stubbed the thing which sends the instant message,
> the existing notification for Jabber would seem to be working,
> because the broken code is inside the method you would need to stub.

That being a method in the library yes? Presumably the library we're
planning on replacing jabber4r with comes with its own test suite? If
so, we just trust that it will do the right thing given the right
input. What we don't have at the moment are any tests to ensure that
it *does* get given the right input.
mathew (Guest)
on 2006-04-15 00:00
(Received via mailing list)
Piers C. wrote:
> Am I correct in remembering that Jabber's a peer to peer protocol?
>

Not really. It's a hybrid protocol--while peer-to-peer connections are
used for some functions, the core presence and messaging involves
connections to a server.

> Presumably you can just fire up a client object in some sort of accept
> connections mode and use that as your jabber server.
>

Unfortunately, the Jabber protocol is somewhat baroque. The designers
decided to make it use stream-based XML, instead of plain text like most
other Internet handshaking protocols. This makes it hard to build a
Jabber server (or client for that matter)--you can't use validating XML
parsers, for example, because you need to be able to parse fragments
that don't constitute a complete document with a DTD. It's about the
second worst Internet protocol I've seen. (The worst is SyncML.)

Anyhow, I think it's pretty funny to be rejecting code based on lack of
tests, when there's an almost complete lack of documentation.


mathew
Piers C. (Guest)
on 2006-04-15 08:52
(Received via mailing list)
mathew <removed_email_address@domain.invalid> writes:
> Anyhow, I think it's pretty funny to be rejecting code based on lack of
> tests, when there's an almost complete lack of documentation.

Huh? Join the non sequitur club, we may not make sense but we do like
pizza!
mathew (Guest)
on 2006-04-15 19:44
(Received via mailing list)
On Apr 14, 2006, at 23:49 , Piers C. wrote:
> mathew <removed_email_address@domain.invalid> writes:
>> Anyhow, I think it's pretty funny to be rejecting code based on
>> lack of
>> tests, when there's an almost complete lack of documentation.
>
> Huh? Join the non sequitur club, we may not make sense but we do like
> pizza!

Documentation is as essential to good software as tests.


mathew
Trejkaz (Guest)
on 2006-04-16 07:02
(Received via mailing list)
On Sunday 16 April 2006 01:42, mathew wrote:
> On Apr 14, 2006, at 23:49 , Piers C. wrote:
> > mathew <removed_email_address@domain.invalid> writes:
> >> Anyhow, I think it's pretty funny to be rejecting code based on
> >> lack of
> >> tests, when there's an almost complete lack of documentation.
> >
> > Huh? Join the non sequitur club, we may not make sense but we do like
> > pizza!
>
> Documentation is as essential to good software as tests.

Actually, it's probably more essential, because without documentation
telling
you how things are supposed to work, there's no way to write new tests.
;-)

TX
Josh S. (Guest)
on 2006-04-16 07:08
(Received via mailing list)
On Apr 15, 2006, at 8:01 PM, Trejkaz wrote:
>>
>> Documentation is as essential to good software as tests.
>
> Actually, it's probably more essential, because without
> documentation telling
> you how things are supposed to work, there's no way to write new
> tests. ;-)

Unless you have convinced yourself that you don't need documentation
because your code is so readable and you have lots of tests that show
what your code is supposed to do.  I don't buy it though.

--
Josh S.
http://blog.hasmanythrough.com
Piers C. (Guest)
on 2006-04-16 19:55
(Received via mailing list)
mathew <removed_email_address@domain.invalid> writes:

> On Apr 14, 2006, at 23:49 , Piers C. wrote:
>> mathew <removed_email_address@domain.invalid> writes:
>>> Anyhow, I think it's pretty funny to be rejecting code based on
>>> lack of
>>> tests, when there's an almost complete lack of documentation.
>>
>> Huh? Join the non sequitur club, we may not make sense but we do like
>> pizza!
>
> Documentation is as essential to good software as tests.

Bollocks. I'd take good tests over good documentation any day of the
week.
mathew (Guest)
on 2006-04-16 20:17
(Received via mailing list)
On Apr 16, 2006, at 10:52 , Piers C. wrote:
> mathew <removed_email_address@domain.invalid> writes:
>> Documentation is as essential to good software as tests.
>
> Bollocks. I'd take good tests over good documentation any day of the
> week.

Well you're wrong, and we've just had a clear example of why you're
wrong discussed on the list.

No amount of unit tests was ever going to tell people that
render_component was deprecated, and that render_sidebar should be
used instead. Hence, people used render_component to render sidebars
in all those fancy competition themes, and they all broke.

End result: poor typo reliability.

Documentation is as essential as unit tests when you have APIs being
used by people who aren't the developers of the API. Anyone who
doesn't see that is a hack.


mathew
Piers C. (Guest)
on 2006-04-16 21:34
(Received via mailing list)
mathew <removed_email_address@domain.invalid> writes:

> On Apr 16, 2006, at 10:52 , Piers C. wrote:
>> mathew <removed_email_address@domain.invalid> writes:
>>> Documentation is as essential to good software as tests.
>>
>> Bollocks. I'd take good tests over good documentation any day of the
>> week.
>
> Well you're wrong, and we've just had a clear example of why you're
> wrong discussed on the list.

Well, up to a point. Yes, our public APIs could do with being better
documented (and as you'll notice from another thread on this list, I'm
working on making the whole theming API a good deal more
understandable/explainable than it is now and I've just written[1] the
beginnings of some documentation of the upcoming new style sidebar
API), but that doesn't make your original observation anything but a
non sequitur. Give me a codebase with good tests and lousy
documentation and I can write the documentation reasonably
quickly. Give me a codebase with apparently excellent documentation
and no tests and I will have very little confidence that it does what
the docs say. Which is why I'm far more insistent about tests than I
am about docs.

> No amount of unit tests was ever going to tell people that
> render_component was deprecated, and that render_sidebar should be
> used instead. Hence, people used render_component to render sidebars
> in all those fancy competition themes, and they all broke.

I don't think the render_component version was even deprecated at the
time of the competition. It should have been, because forcing theme
designers to drop in boilerplate structural code like that is just
asking for trouble. I only broke it relatively recently because I've
been rejigging the sidebar structure to make it slightly less
detestable[2]. I'm pretty sure that I mentioned that render_sidebar
was the preferred way when I added it, both here and in the change
log.

> End result: poor typo reliability.
>
> Documentation is as essential as unit tests when you have APIs being
> used by people who aren't the developers of the API. Anyone who
> doesn't see that is a hack.

Because calling your interlocutor a hack is *always* going to convince
him you're right.


1.
http://www.bofh.org.uk/articles/2006/04/16/write-y...

2. detestable: incabable of being automatically tested
mathew (Guest)
on 2006-04-17 08:45
(Received via mailing list)
Piers C. wrote:
> Give me a codebase with good tests and lousy
> documentation and I can write the documentation reasonably
> quickly.

Yes, but you haven't. And until you do, you'll have a bad codebase,
because the API's requirements and contracts will be undocumented. This
in turn will mean people won't feel confident using the code. If you're
lucky, all you get is few 3rd party plugins or themes. If you're
unlucky, you'll get duplicate code and bloat.

>  Give me a codebase with apparently excellent documentation
> and no tests and I will have very little confidence that it does what
> the docs say.

Which is why I didn't say documentation was an alternative to unit
tests.

I view both as necessary. I'd point out that you're the one taking an
extreme position here, apparently saying that only one of them is.

>  I'm pretty sure that I mentioned that render_sidebar
> was the preferred way when I added it, both here and in the change
> log.
>

Need I mention that change logs and mailing list traffic are not
documentation?

> Because calling your interlocutor a hack is *always* going to convince
> him you're right.
>

On Apr 16, 2006, at 10:52 , Piers C. wrote:

> Bollocks.

Thank you, Mr Pot.


mathew
Morten Liebach (Guest)
on 2006-04-22 02:28
(Received via mailing list)
On 2006-04-16 23:41:33 -0500, mathew wrote:

[snippety-snip]

> Need I mention that change logs and mailing list traffic are not
> documentation?

On the subject of change logs; where's the commit message mailinglist
for Typo?

I haven't been able to find it, and I actually like to follow that kind
of list, if it's there.

Have a nice day
                                 Morten
Kevin B. (Guest)
on 2006-04-22 05:35
(Received via mailing list)
No mailing list, but you can get an RSS feed from Trac:

http://typosphere.org/trac/timeline?
changeset=on&max=50&daysback=90&format=rss
This topic is locked and can not be replied to.