PiRSquared17 / google-highly-open-participation-moinmoin

Automatically exported from code.google.com/p/google-highly-open-participation-moinmoin
0 stars 0 forks source link

Refactor the jabber notification bot and write tests. #67

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There are a few places in the code of our notification bot that could
use some refactoring. Command handling is hardcoded as series of
if...elif statements. Think of an alternative mechanism, implement it,
test it. You can find information about necessary setup on page
[[MoinMoinTodo/Release 1.7/HelpOnNotification]]. Note that the
procedure has not been tested on Windows!

We estimate that this task takes 8 hours of work time and you must
complete this task within 5 days.

 A more detailed description of this issue is available at the
MoinMoin wiki: http://moinmo.in/EasyToDo/JabberBotRefactoring

Original issue reported on code.google.com by webmas...@alexanderweb.de on 28 Nov 2007 at 9:28

GoogleCodeExporter commented 9 years ago
I claim this task

Original comment by ooh...@gmail.com on 3 Dec 2007 at 11:47

GoogleCodeExporter commented 9 years ago
oohall, you got it!

Original comment by Thomas.J...@gmail.com on 3 Dec 2007 at 11:53

GoogleCodeExporter commented 9 years ago
See if this is the right idea, I moved the command handlers into seperate 
functions,
so now handle_command() just acts as a dispatcher which looks up appropriate 
function
from a dictionary, using the command (class) name as the key.

Original comment by ooh...@gmail.com on 4 Dec 2007 at 7:52

Attachments:

GoogleCodeExporter commented 9 years ago
There's a similar piece of code that needs correcting in xmlrpcbot.py as well. 
Fix
it, and you are done, as current patch looks good. :)

Original comment by gryw...@gmail.com on 4 Dec 2007 at 8:01

GoogleCodeExporter commented 9 years ago
Please empty the lines that are only whitespace, so that your patch does not 
add them.

A good idea is also to run either py.test on your stuff (when it is in the 
MoinMoin
source tree) or to run MoinMoin/_tests/pep8.py directly on your file(s).

Note: not all what pep8.py is complaining about makes sense, but quite some of 
it.

Original comment by Thomas.J...@gmail.com on 4 Dec 2007 at 8:07

GoogleCodeExporter commented 9 years ago
Most of the extra whitespace issues should be fixed and I've fixed the if..elif 
in
xmlrpcbot.py.

If anything else jumps at you, let me know.

Original comment by ooh...@gmail.com on 4 Dec 2007 at 9:49

Attachments:

GoogleCodeExporter commented 9 years ago
Could you please change the patch to dispatch on the class objects instead of 
just 
their names? That will make it a bit cleaner.

Original comment by webmas...@alexanderweb.de on 4 Dec 2007 at 3:46

GoogleCodeExporter commented 9 years ago
Hashing with the class instead of the class name. Personally I think the using 
the
name looks cleaner, but it's up to you.

Original comment by ooh...@gmail.com on 4 Dec 2007 at 3:59

Attachments:

GoogleCodeExporter commented 9 years ago
It might have semantic differences that would be hard to spot (imagine somebody 
creating a class with the same name in a different module) :-)

OK, I think Karol should do a final review and apply this patch. Then he mark 
this 
task as completed.

Original comment by webmas...@alexanderweb.de on 4 Dec 2007 at 4:07

GoogleCodeExporter commented 9 years ago
The patch has been commited. Your task is now complete. Good job. :)

Original comment by gryw...@gmail.com on 4 Dec 2007 at 9:45