Subject: | Fix for get_transaction_ids when using Forms.pm from RT 3.8.0's Interface/REST.pm |
Date: | Thu, 9 Oct 2008 12:23:53 -0500 |
To: | bug-RT-Client-REST [...] rt.cpan.org |
From: | "Tony Lambiris" <tonylambiris [...] gmail.com> |
This is sort of dependent on another ticket I have open:
http://rt.cpan.org/Public/Bug/Display.html?id=39868
It appears the way RT::Client::REST currently builds a list of
transaction IDs is by implementing a work-around from a bug in the way
RT was handling strings with a pound sign in the string it was parsing
in form_parse. After fixing it locally on my system and submitting a
bug report (http://rt3.fsck.com//Ticket/Display.html?id=12593), I
wasn't able to retrieve a list of IDs anymore.
Upon further inspection, I found another issue in RT's
Interface/REST.pm in the way it was handling it's fields (bug report
here: http://rt3.fsck.com/Ticket/Display.html?id=12605). After fixing
the regex, Forms.pm was now including a list of transaction IDs. All
that was left was to fix the logic in RT::Client::REST.pm. Currently
the sub get_transaction_ids populates a list of IDs in this fashion:
if (!length($e)) {
my $ex = RT::Client::REST::Exception->_rt_content_to_exception($c);
unless ($ex->message =~ m~^0/~) {
# We do not throw exception if the error is that no values
# were found.
$ex->throw;
}
}
return $e =~ m/^(?:>> )?(\d+):/mg;
As I said before, this relies on a bug being present in the way RT
handles lines that begin with a pound sign. To fix this, all that was
required was the following:
if (!@$o && $c) {
RT::Client::REST::Exception->_rt_content_to_exception($c)->throw;
}
return keys %{$k};
This allows me to retrieve a list of transaction IDs.