From 8a708de9eef22c6e47ce80a2abb2c450c56ec576 Mon Sep 17 00:00:00 2001 From: Aaron Trevena Date: Tue, 5 Jul 2005 18:19:23 +0000 Subject: [PATCH] Fix to Maypole::Model::CDBI order sub from list git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@346 48953598-375a-da11-a14b-00016c27c3ee --- Changes | 2 ++ lib/Maypole/Application.pm | 1 + lib/Maypole/Model/CDBI.pm | 10 +++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index 1791765..c7ecde1 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,8 @@ For information about current developments and future releases, see: Maypole::Model::CDBI::Plain / Maypole Config issue ( http://rt.cpan.org/NoAuth/Bug.html?id=11530 ) Repeat Submission detection support ( Bug #6500 ) Fix to setup_database in Maypole::Model::CDBI ( Bug #12384 ) + Fix to plugin to allow Maypole::Plugin::Config::YAML to work + Fix to Maypole::Model::CDBI order sub from list Additional Requirements : Digest::MD5 diff --git a/lib/Maypole/Application.pm b/lib/Maypole/Application.pm index 0678adb..cd4318f 100644 --- a/lib/Maypole/Application.pm +++ b/lib/Maypole/Application.pm @@ -44,6 +44,7 @@ sub import { my $plugin = "Maypole::Plugin::$_"; if ($plugin->require) { push @plugin_modules, "Maypole::Plugin::$_"; + unshift @ISA, "Maypole::Plugin::$_"; warn "Loaded plugin: $plugin for $caller" if $caller->can('debug') && $caller->debug; } else { diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index 8904a42..c1d3751 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -202,12 +202,12 @@ sub do_pager { sub order { my ( $self, $r ) = @_; - my $order; my %ok_columns = map { $_ => 1 } $self->columns; - if ( $order = $r->query->{order} and $ok_columns{$order} ) { - $order .= ( $r->query->{o2} eq "desc" && " DESC" ); - } - $order; + my $q = $r->query; + my $order = $q->{order}; + return unless $order and $ok_columns{$order}; + $order .= ' DESC' if $q->{o2} and $q->{o2} eq 'desc'; + return $order; } sub list : Exported { -- 2.39.2