diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2012-02-16 16:17:14 -0500 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2012-02-16 16:17:14 -0500 |
commit | bdbd195a77ffae05f24884e7f445d34afce48f15 (patch) | |
tree | 2513fc15f0cf961220fcd50672e2b34448cb4dde /Bugzilla | |
parent | e95d52f72ef1b9c964c826d8a350a55697cb0d95 (diff) | |
download | bugs-bdbd195a77ffae05f24884e7f445d34afce48f15.tar bugs-bdbd195a77ffae05f24884e7f445d34afce48f15.tar.gz bugs-bdbd195a77ffae05f24884e7f445d34afce48f15.tar.bz2 bugs-bdbd195a77ffae05f24884e7f445d34afce48f15.tar.xz bugs-bdbd195a77ffae05f24884e7f445d34afce48f15.zip |
Bug 727541 - Constants in Bugzilla::WebService::Constants should be available inside the templates similar to Bugzilla::Constants
r/a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Template.pm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 98a83f645..c0c9b5db9 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -12,6 +12,7 @@ use strict; use Bugzilla::Bug; use Bugzilla::Constants; +use Bugzilla::WebService::Constants; use Bugzilla::Hook; use Bugzilla::Install::Requirements; use Bugzilla::Install::Util qw(install_string template_include_path @@ -48,9 +49,9 @@ sub SAFE_URL_REGEXP { return qr/($safe_protocols):[^\s<>\"]+[\w\/]/i; } -# Convert the constants in the Bugzilla::Constants module into a hash we can -# pass to the template object for reflection into its "constants" namespace -# (which is like its "variables" namespace, but for constants). To do so, we +# Convert the constants in the Bugzilla::Constants and Bugzilla::WebService::Constants +# modules into a hash we can pass to the template object for reflection into its "constants" +# namespace (which is like its "variables" namespace, but for constants). To do so, we # traverse the arrays of exported and exportable symbols and ignoring the rest # (which, if Constants.pm exports only constants, as it should, will be nothing else). sub _load_constants { @@ -66,6 +67,18 @@ sub _load_constants { $constants{$constant} = (scalar(@list) == 1) ? $list[0] : \@list; } } + + foreach my $constant (@Bugzilla::WebService::Constants::EXPORT, + @Bugzilla::WebService::Constants::EXPORT_OK) + { + if (ref Bugzilla::WebService::Constants->$constant) { + $constants{$constant} = Bugzilla::WebService::Constants->$constant; + } + else { + my @list = (Bugzilla::WebService::Constants->$constant); + $constants{$constant} = (scalar(@list) == 1) ? $list[0] : \@list; + } + } return \%constants; } |