From: Eric Wong Date: Thu, 24 Dec 2015 01:39:45 +0000 (+0000) Subject: repobrowse: DRY-up query class and support id2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=854862946453e829243735e22c6cabc43b47a70c;p=thirdparty%2Fpublic-inbox.git repobrowse: DRY-up query class and support id2 We'll be adding diff support against arbitrary objects, soon (which could cause us to be OOM-ed easily if we're not careful with big objects). --- diff --git a/lib/PublicInbox/RepoBrowseQuery.pm b/lib/PublicInbox/RepoBrowseQuery.pm index 979a2b683..861e587b6 100644 --- a/lib/PublicInbox/RepoBrowseQuery.pm +++ b/lib/PublicInbox/RepoBrowseQuery.pm @@ -1,16 +1,18 @@ # Copyright (C) 2015 all contributors # License: AGPL-3.0+ +# query parameter management for repobrowse package PublicInbox::RepoBrowseQuery; use strict; use warnings; use PublicInbox::Hval; +my @KNOWN_PARAMS = qw(id id2 h showmsg ofs); sub new { my ($class, $cgi) = @_; my $self = bless {}, $class; - foreach my $k (qw(id h showmsg ofs)) { + foreach my $k (@KNOWN_PARAMS) { my $v = $cgi->param($k); $self->{$k} = defined $v ? $v : ''; } @@ -27,7 +29,7 @@ sub qs { } my @qs; - foreach my $k (qw(id h showmsg ofs)) { + foreach my $k (@KNOWN_PARAMS) { my $v = $self->{$k}; next if ($v eq '');