Closed Bug 412850 Opened 16 years ago Closed 16 years ago

Rename the webservice method Bug.get_bugs() to simple Bug.get()

Categories

(Bugzilla :: WebService, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.2

People

(Reporter: dkl, Assigned: dkl)

Details

Attachments

(1 file, 2 obsolete files)

I suggest that a consistent naming scheme is adopted for the the WebService methods. For example, Bug.get_bugs() is redundant in that it contains the bug work twice. Making it Bug.get() is easier to understand and less to type. The method would still accepts a single bug id or alias or list of bug id's and aliases.

This would be more in line with the current method Bug.create() and the soon to be added method Bug.update().

And then extended further into Product.get(), Product.create(), Product.update(),
User.get(), User.create() and so on.

Thoughts?
Dave
Yes, agreed completely.

However, leave around the old names as aliases, so that we don't break existing WebService users.

BEGIN { *get_bugs = \&get }
Attachment #297616 - Flags: review? → review?(bugzilla-mozilla)
Comment on attachment 297616 [details] [diff] [review]
Patch to rename Bug.get_bugs() to Bug.get() in Bugzilla/WebServices/Bug.pm and contrib/bz_webservice_demo.pl

>Index: contrib/bz_webservice_demo.pl

That still has an outdated reference:
> Call C<Bug.get_bug> with the ID of the bug you want to know more of.

Change that for r+.
Attachment #297616 - Flags: review?(bugzilla-mozilla) → review-
Thanks. I did a search for 'get_bugs' in the bz_webservice_demo.pl file so I missed that one since it was mispelled ;) Attaching updated patch.
Assignee: webservice → dkl
Attachment #297616 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #297672 - Flags: review?(bugzilla-mozilla)
Comment on attachment 297672 [details] [diff] [review]
Patch to rename Bug.get_bugs() to Bug.get() (v2)

The docs should note that applications that want to be compatible with Bugzilla 3.0 should call it as get_bugs.
Attachment #297672 - Flags: review?(bugzilla-mozilla) → review-
Added note to documentation stating that get_bugs could also be used for compatibility with 3.0 API.
Attachment #297672 - Attachment is obsolete: true
Attachment #297687 - Flags: review?(bugzilla-mozilla)
Attachment #297687 - Flags: review?(mkanat)
Comment on attachment 297687 [details] [diff] [review]
Patch to rename Bug.get_bugs() to Bug.get() (v3)

Looks good to me.

Checkin fix: "with the Bugzilla"
Attachment #297687 - Flags: review?(mkanat)
Attachment #297687 - Flags: review?(bugzilla-mozilla)
Attachment #297687 - Flags: review+
Severity: normal → enhancement
Flags: approval+
OS: Linux → All
Hardware: PC → All
Target Milestone: --- → Bugzilla 3.2
(In reply to comment #1)
> BEGIN { *get_bugs = \&get }

What's the advantage of doing that in a BEGIN block? Why not just

*get_bugs = \&get;

?
It makes the subroutine resolve at compile time if you need that for some reason. I suspect it may have other advantages as well (though they're slipping my mind at the moment, I've had to do it before).
Checking in Bugzilla/WebService/Bug.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm,v  <--  Bug.pm
new revision: 1.10; previous revision: 1.9
done
Checking in contrib/bz_webservice_demo.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/bz_webservice_demo.pl,v  <--  bz_webservice_demo.pl
new revision: 1.13; previous revision: 1.12
done
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Shouldn't we apply this patch to 3.0 as well so that we can use Bug.get() independently on both 3.0 and 3.2? Else you have to keep in mind that Bug.get() won't work on 3.0.
(In reply to comment #11)
> Shouldn't we apply this patch to 3.0 as well so that we can use Bug.get()
> independently on both 3.0 and 3.2? Else you have to keep in mind that Bug.get()
> won't work on 3.0.

  No, it's better to know consistently that get() doesn't work on any 3.0 version, and not have to check exactly which 3.0.x you're running to know for certain.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: