Refactor whois_get_whois()

deviantintegral - March 21, 2009 - 18:48
Project:Whois lookup
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review
Description

Here is a patch which splits this function into whois_get_whois() and whois_display_whois(). That way, it becomes possible for other modules to use this module as a wrapper around the phpwhois library.

It also moves the watchdog function into the whois_get_whois() function so when other modules do a lookup it's logged.

AttachmentSize
refactor_whois_get_whois.patch4.54 KB

#1

deviantintegral - March 21, 2009 - 18:48
Status:active» needs review

#2

tom friedhof - May 8, 2009 - 06:38
Status:needs review» reviewed & tested by the community

The patch installs fine with no errors and it doesn't break the module after testing it.

I like this code change because it splits a function into two smaller more focused functions so that the process of retrieving a whois object and the process of displaying the result of the whois object are now two different functions.

Good job deviantintegral.

#3

helmo - June 5, 2009 - 15:11

I'm sorry to report that it did break the selected output method. Since the line fetching of whois_output_method was lost the basic method was always shown.

I've taken the liberty to address several other code style issues inspired by code-style.pl

Attached are patches both against 1.1 and against 1.1 + refactor_whois_get_whois.patch

AttachmentSize
refactor_whois_get_whois-1_incremental.patch 1.49 KB
refactor_whois_get_whois-1.patch 5.51 KB

#4

xyber - June 23, 2009 - 14:32

Hey man, i rcv an error while
=====
patching patching file whois.module
Hunk #1 FAILED at 11.
Hunk #2 FAILED at 102.
Hunk #3 FAILED at 111.
Hunk #4 FAILED at 156.
Hunk #5 FAILED at 186.
Hunk #6 FAILED at 201.
6 out of 6 hunks FAILED -- saving rejects to file whois.module.rej
=====
patching file whois.module
Hunk #1 FAILED at 164.
Hunk #2 FAILED at 186.
2 out of 2 hunks FAILED -- saving rejects to file whois.module.rej
=====

Any idea why? I ran the "# patch < refactor_whois_get_whois-1.patch" and "# patch < refactor_whois_get_whois-1_incremental.patch" command. Any idea?

-Xyber.

#5

helmo - June 23, 2009 - 15:02

Do you have a clean version of whois-6.x-1.1.tar.gz extracted?

Try using the -p1 option while while you are inside the whois directory,

It should look like:

$ patch < refactor_whois_get_whois-1.patch
patching file whois.module

PS: The incremental version is only usefull if you already applied refactor_whois_get_whois.patch, so you probably don't need it.

#6

xyber - June 23, 2009 - 16:02

Hi,

Yes its a clean extraction. But it produces the error. If i add the p1 option it just stays there until i break operation.

-Xyber.

#7

helmo - June 24, 2009 - 11:30

Unless patch isn't getting input, it should just finish or produce an error.

I asked a friend to verify that the patchfile is ok, and he could confirm this.

Have you looked at http://drupal.org/patch/apply ? It might help you track down the problem.

#8

xyber - June 25, 2009 - 05:30
Status:reviewed & tested by the community» fixed

Did an uninstall and reinstalled again. Didn't produce the error. Thanks man!

-Xyber.

#9

Gurpartap Singh - June 25, 2009 - 06:15
Status:fixed» needs review
 
 

Drupal is a registered trademark of Dries Buytaert.