[Bps-public-commit] App-Changeloggr branch, master, updated. f69f16883b966083bd734bf5b5cfde1e8d5a0509

sartak at bestpractical.com sartak at bestpractical.com
Fri May 22 16:15:19 EDT 2009


The branch, master has been updated
       via  f69f16883b966083bd734bf5b5cfde1e8d5a0509 (commit)
      from  7286e84f33693366506481a581ce871321107c5a (commit)

Summary of changes:
 .../{Model/TagCollection.pm => Collection.pm}      |   15 +++++++----
 lib/App/Changeloggr/Model/TagCollection.pm         |   25 ++-----------------
 2 files changed, 12 insertions(+), 28 deletions(-)
 copy lib/App/Changeloggr/{Model/TagCollection.pm => Collection.pm} (56%)

- Log -----------------------------------------------------------------
commit f69f16883b966083bd734bf5b5cfde1e8d5a0509
Author: Shawn M Moore <sartak at gmail.com>
Date:   Fri May 22 16:14:46 2009 -0400

    Move limit_to_visible from TagCollection to Collection

diff --git a/lib/App/Changeloggr/Model/TagCollection.pm b/lib/App/Changeloggr/Collection.pm
similarity index 56%
copy from lib/App/Changeloggr/Model/TagCollection.pm
copy to lib/App/Changeloggr/Collection.pm
index 1389c75..51f476a 100644
--- a/lib/App/Changeloggr/Model/TagCollection.pm
+++ b/lib/App/Changeloggr/Collection.pm
@@ -1,14 +1,16 @@
-package App::Changeloggr::Model::TagCollection;
+package App::Changeloggr::Collection;
 use strict;
 use warnings;
-use base 'App::Changeloggr::Collection';
+use base 'Jifty::Collection';
 
 sub limit_to_visible {
-    my $self = shift;
+    my $self   = shift;
+    my $column = shift
+        or die "limit_to_visible takes a column name";
 
     if ($self->_handle->isa('Jifty::DBI::Handle::SQLite')) {
         $self->limit(
-            column   => 'text',
+            column   => $column,
             escape   => '\\',
             operator => 'NOT LIKE',
             value    => '\_%',
@@ -16,14 +18,14 @@ sub limit_to_visible {
     }
     elsif ($self->_handle->isa('Jifty::DBI::Handle::Pg')) {
         $self->limit(
-            column      => 'text',
+            column      => $column,
             operator    => 'NOT LIKE',
             value       => q{E'\\\\_%'},
             quote_value => 0,
         );
     }
     else {
-        Carp::confess "You must use SQLite or Postgres, or fix TagCollection->limit_to_visible for your RDBMS. Sorry. :(";
+        Carp::confess "You must use SQLite or Postgres, or fix App::Changeloggr::Collection->limit_to_visible for your RDBMS. Sorry. :(";
     }
 
     return $self;
@@ -31,3 +33,4 @@ sub limit_to_visible {
 
 1;
 
+
diff --git a/lib/App/Changeloggr/Model/TagCollection.pm b/lib/App/Changeloggr/Model/TagCollection.pm
index 1389c75..0edea2d 100644
--- a/lib/App/Changeloggr/Model/TagCollection.pm
+++ b/lib/App/Changeloggr/Model/TagCollection.pm
@@ -4,29 +4,10 @@ use warnings;
 use base 'App::Changeloggr::Collection';
 
 sub limit_to_visible {
-    my $self = shift;
+    my $self   = shift;
+    my $column = shift || 'text';
 
-    if ($self->_handle->isa('Jifty::DBI::Handle::SQLite')) {
-        $self->limit(
-            column   => 'text',
-            escape   => '\\',
-            operator => 'NOT LIKE',
-            value    => '\_%',
-        );
-    }
-    elsif ($self->_handle->isa('Jifty::DBI::Handle::Pg')) {
-        $self->limit(
-            column      => 'text',
-            operator    => 'NOT LIKE',
-            value       => q{E'\\\\_%'},
-            quote_value => 0,
-        );
-    }
-    else {
-        Carp::confess "You must use SQLite or Postgres, or fix TagCollection->limit_to_visible for your RDBMS. Sorry. :(";
-    }
-
-    return $self;
+    $self->SUPER::limit_to_visible($column, @_);
 }
 
 1;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list