[Jifty-commit] r4878 - in jifty/trunk: lib/Jifty/Plugin/REST
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Fri Jan 18 06:47:03 EST 2008
Author: sartak
Date: Fri Jan 18 06:47:02 2008
New Revision: 4878
Modified:
jifty/trunk/ (props changed)
jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
Log:
r50523 at onn: sartak | 2008-01-18 06:45:25 -0500
Don't 404 on a search with no results
Modified: jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm (original)
+++ jifty/trunk/lib/Jifty/Plugin/REST/Dispatcher.pm Fri Jan 18 06:47:02 2008
@@ -549,7 +549,7 @@
sub search_items {
my ($model, $fragment) = (model($1), $2);
my @pieces = grep {length} split '/', $fragment;
- my @orig = @pieces;
+ my $ret = ['search', $model, @pieces];
# if they provided an odd number of pieces, the last is the output column
my $field;
@@ -645,13 +645,13 @@
);
}
- $collection->count or abort(404);
- $collection->pager->entries_on_this_page or abort(404);
+ $collection->count or return outs($ret, []);
+ $collection->pager->entries_on_this_page or return outs($ret, []);
# output
if (defined $field) {
my $item = $collection->first
- or abort(404);
+ or return outs($ret, []);
# make sure $field exists and is a real column
$item->can($field) or abort(404);
@@ -664,16 +664,10 @@
push @values, $item->$field;
} while $item = $collection->next;
- outs(
- ['search', $model, @orig],
- \@values,
- );
+ outs($ret, \@values);
}
else {
- outs(
- ['search', $model, @orig],
- $collection->jifty_serialize_format,
- );
+ outs($ret, $collection->jifty_serialize_format);
}
}
More information about the Jifty-commit
mailing list