[jifty-devel] RE: [Jifty-commit] r2859 - in Jifty-DBI/trunk: lib/Jifty/DBI

Andrew Sterling Hanenkamp andrew.hanenkamp at boomer.com
Wed Feb 28 10:03:57 EST 2007


 
What about cases where someone might use Storable and base64 together?

column prefs =>
  type is 'text',
  filters are qw/ 
      Jifty::DBI::Filter::Storable
      Jifty::DBI::Filter::base64
   /;

It also seems like this patch breaks the separation of concerns between
the filter and record classes. If there's going to be error checking
about the column being the correct type for a filter, it needs to be a
check done by the filter.

Cheers,
Sterling

--
Andrew Sterling Hanenkamp
Interaction Developer
Boomer Consulting, Inc.
 
1.785.537.2358 ext. 17
1.888.266.6375 ext. 17
1.785.537.4545 (fax)
 
610 Humboldt
Manhattan, KS 66502
 
http://www.boomer.com/about/team/andrew-hanenkamp.html
andrew.hanenkamp at boomer.com

-----Original Message-----
From: jifty-commit-bounces at lists.jifty.org
[mailto:jifty-commit-bounces at lists.jifty.org] On Behalf Of
jifty-commit at lists.jifty.org
Sent: Tuesday, February 27, 2007 9:07 PM
To: jifty-commit at lists.jifty.org
Subject: [Jifty-commit] r2859 - in Jifty-DBI/trunk: lib/Jifty/DBI

Author: trs
Date: Tue Feb 27 22:07:09 2007
New Revision: 2859

Modified:
   Jifty-DBI/trunk/   (props changed)
   Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm

Log:
 r19823 at zot:  tom | 2007-02-27 22:07:00 -0500  Die on incorrect column
type when using the Storable filter


Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
========================================================================
======
--- Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	(original)
+++ Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm	Tue Feb 27 22:07:09 2007
@@ -236,6 +236,15 @@
     # through add_column
     $column->record_class( $package ) if not $column->record_class;
 
+    # Check for the correct column type when the Storable filter is in
use
+    if ( grep { $_ eq 'Jifty::DBI::Filter::Storable' }
+              ($column->input_filters, $column->output_filters)
+         and $column->type !~ /^(blob|bytea)$/i)
+    {
+        die "Column '$column_name' in @{[$column->record_class]} ".
+            "uses the Storable filter but is not of type 'blob'.\n";
+    }
+
     no strict 'refs';    # We're going to be defining subs
 
     if ( not $self->can($column_name) ) {
_______________________________________________
Jifty-commit mailing list
Jifty-commit at lists.jifty.org
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-commit


More information about the jifty-devel mailing list