Last Comment Bug 381737 - Unable to get legal values of custom fields via XML-RPC
: Unable to get legal values of custom fields via XML-RPC
Status: RESOLVED FIXED
:
Product: Bugzilla
Classification: Server Software
Component: WebService (show other bugs)
: 3.0
: All All
: -- normal (vote)
: Bugzilla 3.0
Assigned To: Frédéric Buclin
: default-qa
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-23 09:16 PDT by Paolo Galati
Modified: 2007-05-26 05:02 PDT (History)
2 users (show)
mkanat: approval+
mkanat: approval3.0+
mkanat: blocking3.0.1+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
patch to Bug.pm module for custom fields not returned via xmlrpc (580 bytes, patch)
2007-05-24 08:49 PDT, Paolo Galati
mkanat: review-
Details | Diff | Splinter Review
patch, v1 (656 bytes, patch)
2007-05-25 16:59 PDT, Frédéric Buclin
mkanat: review+
Details | Diff | Splinter Review
fix for bz_webservice_demo.pl to get legal field values, v1 (1.52 KB, patch)
2007-05-25 17:12 PDT, Frédéric Buclin
mkanat: review+
Details | Diff | Splinter Review
POD for the --field option of bz_webservice_demo.pl (731 bytes, patch)
2007-05-26 05:02 PDT, Frédéric Buclin
LpSolit: review+
Details | Diff | Splinter Review

Description Paolo Galati 2007-05-23 09:16:30 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; it; rv:1.8.1.3) Gecko/20070514 Firefox/2.0.0.3
Build Identifier: Bugzilla version 3.0 stable

Calling legal_values() from Bugzilla::Webservice::Bug API passing custom field name (cf_browser_ver) result in an error like this:

<Fault 108: "Can't use cf_browser_ver as a field name.">

Reproducible: Always



Expected Results:  
Expecting list of actual values of custom field
Comment 1 Max Kanat-Alexander 2007-05-23 14:16:19 PDT
Yeah, this was originally intentional, but I think we should allow it for 3.0.1.
Comment 2 Paolo Galati 2007-05-24 04:13:01 PDT
But is a strange behavior, the code below taken from Bug.pm

    my @custom_select =
        Bugzilla->get_fields({ type => FIELD_TYPE_SINGLE_SELECT });

seems to get exactly custom fields from database, but subsequent line return false.

    grep($_ eq $field, GLOBAL_SELECT_FIELDS, @custom_select)


for this reason i thought this was a bug.
Comment 3 Paolo Galati 2007-05-24 08:49:06 PDT
Created attachment 265950 [details] [diff] [review]
patch to Bug.pm module for custom fields not returned via xmlrpc

Hi All
in attach my actual solution waiting for 3.0.1

Kind regards
Comment 4 Max Kanat-Alexander 2007-05-24 13:28:14 PDT
Comment on attachment 265950 [details] [diff] [review]
patch to Bug.pm module for custom fields not returned via xmlrpc

These are objects, not hashes. All we need to do is to do a map { $_->name } @custom_select.
Comment 5 Max Kanat-Alexander 2007-05-24 13:29:22 PDT
This is now a blocker, since this was supposed to work in 3.0.
Comment 6 Paolo Galati 2007-05-25 01:00:33 PDT
(In reply to comment #4)
> (From update of attachment 265950 [details] [diff] [review])
> These are objects, not hashes. All we need to do is to do a map { $_->name }
> @custom_select.
> 

Yes, but i am not so good in programming perl, my scripting language are python and ruby, i just find the simplest solution based on my poor perl knowledge.

best regards.
Comment 7 Frédéric Buclin 2007-05-25 16:59:28 PDT
Created attachment 266142 [details] [diff] [review]
patch, v1
Comment 8 Frédéric Buclin 2007-05-25 17:12:16 PDT
Created attachment 266146 [details] [diff] [review]
fix for bz_webservice_demo.pl to get legal field values, v1
Comment 9 Max Kanat-Alexander 2007-05-25 17:41:44 PDT
Comment on attachment 266146 [details] [diff] [review]
fix for bz_webservice_demo.pl to get legal field values, v1

>+    print "$_\n" foreach (@{$result->{values}});

  Just do a join(). Otherwise this is fine. :-)
Comment 10 Frédéric Buclin 2007-05-25 18:03:50 PDT
tip:

Checking in Bugzilla/WebService/Bug.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm,v  <--  Bug.pm
new revision: 1.5; previous revision: 1.4
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.8; previous revision: 1.7
done


3.0:

Checking in Bugzilla/WebService/Bug.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/WebService/Bug.pm,v  <--  Bug.pm
new revision: 1.4.2.1; previous revision: 1.4
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.7.2.1; previous revision: 1.7
done
Comment 11 Frédéric Buclin 2007-05-26 05:02:25 PDT
Created attachment 266178 [details] [diff] [review]
POD for the --field option of bz_webservice_demo.pl

I forgot to include POD for the --field attribute. Here is the patch I checked in.

tip:

Checking in contrib/bz_webservice_demo.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/bz_webservice_demo.pl,v  <--  bz_webservice_demo.pl
new revision: 1.9; previous revision: 1.8
done

3.0:

Checking in contrib/bz_webservice_demo.pl;
/cvsroot/mozilla/webtools/bugzilla/contrib/bz_webservice_demo.pl,v  <--  bz_webservice_demo.pl
new revision: 1.7.2.2; previous revision: 1.7.2.1
done

Note You need to log in before you can comment on or make changes to this bug.