r50546 - in /trunk/libhtml-formfu-perl: ./ debian/ debian/patches/ debian/source/ lib/HTML/ lib/HTML/FormFu/Constraint/Repeatable/ lib/HTML/FormFu/Model/ t/elements/ t/model/

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Sat Jan 9 12:50:50 UTC 2010


Author: ansgar-guest
Date: Sat Jan  9 12:50:44 2010
New Revision: 50546

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=50546
Log:
* New upstream release.
  + Fixes issues with new year in test suite. (Closes: #564402)
* Use source format 3.0 (quilt).

Added:
    trunk/libhtml-formfu-perl/debian/patches/spelling.patch
    trunk/libhtml-formfu-perl/debian/source/
    trunk/libhtml-formfu-perl/debian/source/format
Removed:
    trunk/libhtml-formfu-perl/debian/README.source
Modified:
    trunk/libhtml-formfu-perl/Changes
    trunk/libhtml-formfu-perl/META.yml
    trunk/libhtml-formfu-perl/debian/changelog
    trunk/libhtml-formfu-perl/debian/control
    trunk/libhtml-formfu-perl/debian/patches/series
    trunk/libhtml-formfu-perl/debian/rules
    trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm
    trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint/Repeatable/Any.pm
    trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm
    trunk/libhtml-formfu-perl/t/elements/date_undef.t
    trunk/libhtml-formfu-perl/t/model/hashref_escaping.t

Modified: trunk/libhtml-formfu-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/Changes?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/Changes (original)
+++ trunk/libhtml-formfu-perl/Changes Sat Jan  9 12:50:44 2010
@@ -1,3 +1,10 @@
+0.06001 2010-01-08
+
+    - Fixed issue with Model::HashRef where form fields with an underscore
+      and overlapping name (e.g. 'foo' and 'foo_bar') were causing problems
+    
+    - Fix test suite year issue.
+
 0.06000 2009-12-10
 
     - New get_parent() method that traverses the parent hierarchy, returning

Modified: trunk/libhtml-formfu-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/META.yml?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/META.yml (original)
+++ trunk/libhtml-formfu-perl/META.yml Sat Jan  9 12:50:44 2010
@@ -59,4 +59,4 @@
   perl: 5.8.1
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.06000
+version: 0.06001

Modified: trunk/libhtml-formfu-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/debian/changelog?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/debian/changelog (original)
+++ trunk/libhtml-formfu-perl/debian/changelog Sat Jan  9 12:50:44 2010
@@ -1,3 +1,11 @@
+libhtml-formfu-perl (0.06001-1) unstable; urgency=low
+
+  * New upstream release.
+    + Fixes issues with new year in test suite. (Closes: #564402)
+  * Use source format 3.0 (quilt).
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sat, 09 Jan 2010 21:50:24 +0900
+
 libhtml-formfu-perl (0.06000-1) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/libhtml-formfu-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/debian/control?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/debian/control (original)
+++ trunk/libhtml-formfu-perl/debian/control Sat Jan  9 12:50:44 2010
@@ -1,7 +1,7 @@
 Source: libhtml-formfu-perl
 Section: perl
 Priority: optional
-Build-Depends: debhelper (>= 7.0.50), quilt (>= 0.46-7)
+Build-Depends: debhelper (>= 7.0.50)
 Build-Depends-Indep: perl, libdatetime-perl (>= 0.38),
  libhtml-scrubber-perl, libemail-valid-perl, libdatetime-format-strptime-perl,
  libdatetime-format-builder-perl (>= 0.7901), libdatetime-format-natural-perl,

Modified: trunk/libhtml-formfu-perl/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/debian/patches/series?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/debian/patches/series (original)
+++ trunk/libhtml-formfu-perl/debian/patches/series Sat Jan  9 12:50:44 2010
@@ -1,3 +1,4 @@
 whatis-entries.diff
 how-to-report-bugs.diff
 pod-for-html_formfu_dumpconf.diff
+spelling.patch

Added: trunk/libhtml-formfu-perl/debian/patches/spelling.patch
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/debian/patches/spelling.patch?rev=50546&op=file
==============================================================================
--- trunk/libhtml-formfu-perl/debian/patches/spelling.patch (added)
+++ trunk/libhtml-formfu-perl/debian/patches/spelling.patch Sat Jan  9 12:50:44 2010
@@ -1,0 +1,101 @@
+From: Ansgar Burchardt <ansgar at 43-1.org>
+Date: Sat, 09 Jan 2010 21:42:48 +0900
+Subject: Fix spelling errors
+
+This patch fixes several spelling errors pointed out by lintian.
+--- libhtml-formfu-perl.orig/lib/HTML/FormFu.pm
++++ libhtml-formfu-perl/lib/HTML/FormFu.pm
+@@ -1992,7 +1992,7 @@
+ Deflators will also be run on the value.
+ 
+ If you set this on a field with an Inflator, but without an equivalent
+-Deflator, you should ensure that the Inflators stringify back to a useable
++Deflator, you should ensure that the Inflators stringify back to a usable
+ value, so as not to confuse / annoy the user.
+ 
+ Default Value: false
+@@ -3062,21 +3062,21 @@
+ 
+ =head2 element_defaults
+ 
+-Is deprecated and provided only for backwards compatability. Will be removed
++Is deprecated and provided only for backwards compatibility. Will be removed
+ at some point in the future.
+ 
+ See L</default_args> instead.
+ 
+ =head2 model_class
+ 
+-Is deprecated and provided only for backwards compatability. Will be removed
++Is deprecated and provided only for backwards compatibility. Will be removed
+ at some point in the future.
+ 
+ Use L</default_model> instead.
+ 
+ =head2 defaults_from_model
+ 
+-Is deprecated and provided only for backwards compatability. Will be removed
++Is deprecated and provided only for backwards compatibility. Will be removed
+ at some point in the future.
+ 
+ Use L<HTML::FormFu::Model/default_values> instead.
+@@ -3085,7 +3085,7 @@
+ 
+ =head2 save_to_model
+ 
+-Is deprecated and provided only for backwards compatability. Will be removed
++Is deprecated and provided only for backwards compatibility. Will be removed
+ at some point in the future.
+ 
+ Use L<HTML::FormFu::Model/update> instead.
+@@ -3094,7 +3094,7 @@
+ 
+ =head1 DEPRECATION POLICY
+ 
+-We try our best to not make incompatable changes, but if they're required
++We try our best to not make incompatible changes, but if they're required
+ we'll make every effort possible to provide backwards compatibility for
+ several release-cycles, issuing a warnings about the changes, before removing
+ the legacy features.
+--- libhtml-formfu-perl.orig/lib/HTML/FormFu/Element.pm
++++ libhtml-formfu-perl/lib/HTML/FormFu/Element.pm
+@@ -589,7 +589,7 @@
+ 
+ =head2 db
+ 
+-Is deprecated and provided only for backwards compatability. Will be removed
++Is deprecated and provided only for backwards compatibility. Will be removed
+ at some point in the future.
+ 
+ Use L</model_config> instead.
+--- libhtml-formfu-perl.orig/lib/HTML/FormFu/Element/_Group.pm
++++ libhtml-formfu-perl/lib/HTML/FormFu/Element/_Group.pm
+@@ -540,7 +540,7 @@
+           - 12 
+ 
+ Similar to L</values>, but the last 2 values are expanded to a range. Any 
+-preceeding values are used literally, allowing the common empty first item 
++preceding values are used literally, allowing the common empty first item
+ in select menus.
+ 
+ =head2 empty_first
+--- libhtml-formfu-perl.orig/lib/HTML/FormFu/Filter/CopyValue.pm
++++ libhtml-formfu-perl/lib/HTML/FormFu/Filter/CopyValue.pm
+@@ -28,7 +28,7 @@
+ 
+ =head1 NAME
+ 
+-HTML::FormFu::Filter::CopyValue - copy the value from an other field
++HTML::FormFu::Filter::CopyValue - copy the value from another field
+ 
+ =head1 SYNOPSIS
+ 
+@@ -49,7 +49,7 @@
+ =head1 CAVEATS
+ 
+ If the value of the original field contains an invalid value (a value that
+-will be constrained through a constraint) this invalid value will be choosen
++will be constrained through a constraint) this invalid value will be chosen
+ for this field (the field with CopyValue filter).
+ 
+ So the user has to change two fields or you remove the invalid value in a

Modified: trunk/libhtml-formfu-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/debian/rules?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/debian/rules (original)
+++ trunk/libhtml-formfu-perl/debian/rules Sat Jan  9 12:50:44 2010
@@ -4,7 +4,7 @@
 MANDIR=$(CURDIR)/debian/libhtml-formfu-perl/usr/share/man/man3
 
 %:
-	dh --with quilt $@
+	dh $@
 
 override_dh_auto_install:
 	dh_auto_install

Added: trunk/libhtml-formfu-perl/debian/source/format
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/debian/source/format?rev=50546&op=file
==============================================================================
--- trunk/libhtml-formfu-perl/debian/source/format (added)
+++ trunk/libhtml-formfu-perl/debian/source/format Sat Jan  9 12:50:44 2010
@@ -1,0 +1,1 @@
+3.0 (quilt)

Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu.pm Sat Jan  9 12:50:44 2010
@@ -112,7 +112,7 @@
 *plugins           = \&plugin;
 *add_plugins       = \&add_plugin;
 
-our $VERSION = '0.06000';
+our $VERSION = '0.06001';
 $VERSION = eval $VERSION;
 
 Class::C3::initialize();

Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint/Repeatable/Any.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint/Repeatable/Any.pm?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint/Repeatable/Any.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Constraint/Repeatable/Any.pm Sat Jan  9 12:50:44 2010
@@ -27,11 +27,11 @@
     my $repeatable = $field->get_parent({ type => 'Repeatable' });
     my $pass;
 
-    my $original_name = $field->original_name;
+    my $original_name = $field->original_name || '';
 
     my @fields =
         grep { $_->get_parent({ type => 'Repeatable' }) == $repeatable }
-        grep { $_->original_name eq $original_name }
+        grep { ( $_->original_name || '' ) eq $original_name }
             @{ $repeatable->get_fields };
 
     my $increment_field_names = $repeatable->increment_field_names;

Modified: trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm (original)
+++ trunk/libhtml-formfu-perl/lib/HTML/FormFu/Model/HashRef.pm Sat Jan  9 12:50:44 2010
@@ -105,9 +105,10 @@
 sub create {
     my $self = shift;
     if($self->form->submitted) {
+        my $input = _escape_hash($self->form->input);
         my $hf = new Hash::Flatten(
             { ArrayDelimiter => '_', HashDelimiter => '.' } );
-        my $input = $hf->unflatten($self->form->input);
+        $input = _unescape_hash($hf->unflatten($self->form->input));
         $self->default_values( $self->_unfold_repeatable($self->form, $input) );
     }
     $self->form->render_data;
@@ -178,6 +179,28 @@
         $self->flatten ? $names : $hf->unflatten($names) );
 }
 
+sub _escape_hash {
+    my $hash = shift;
+    my $method = shift || \&_escape_name;
+    return $hash unless(ref $hash);
+    foreach my $k (keys %$hash) {
+        my $v = delete $hash->{$k};
+        if(ref $v eq 'HASH') {
+            $hash->{$method->($k)} = _escape_hash($v, $method);
+        } elsif(ref $v eq 'ARRAY') {
+            $hash->{$method->($k)} = [ map { _escape_hash($_, $method) } @$v];
+        } else {
+            $hash->{$method->($k)} = $v;
+        }
+    }
+    return $hash;
+}
+
+
+sub _unescape_hash {
+    return _escape_hash(shift, \&_unescape_name);
+}
+
 sub _escape_name {
     my $name = shift;
     $name =~ s/_/\\_/g;

Modified: trunk/libhtml-formfu-perl/t/elements/date_undef.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/t/elements/date_undef.t?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/t/elements/date_undef.t (original)
+++ trunk/libhtml-formfu-perl/t/elements/date_undef.t Sat Jan  9 12:50:44 2010
@@ -8,7 +8,7 @@
 my $form = HTML::FormFu->new(
     { tt_args => { INCLUDE_PATH => 'share/templates/tt/xhtml' } } );
 
-$form->populate({elements => [{type => "Date", name => "foo", default => '30-08-2009'}]});
+$form->populate({elements => [{type => "Date", name => "foo", year => {list => [2009]}, default => '30-08-2009'}]});
 
 $form->process;
 
@@ -16,4 +16,4 @@
 
 $form->get_field('foo')->default(undef);
 
-like($form->render, qr/value="2009">/);
+like($form->render, qr/value="2009">/);

Modified: trunk/libhtml-formfu-perl/t/model/hashref_escaping.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libhtml-formfu-perl/t/model/hashref_escaping.t?rev=50546&op=diff
==============================================================================
--- trunk/libhtml-formfu-perl/t/model/hashref_escaping.t (original)
+++ trunk/libhtml-formfu-perl/t/model/hashref_escaping.t Sat Jan  9 12:50:44 2010
@@ -1,8 +1,9 @@
 use strict;
 use warnings;
 
-use Test::More tests => 5;
+use Test::More;
 
+use HTML::FormFu;
 use HTML::FormFu::Model::HashRef;
 
 my %test = (
@@ -17,3 +18,55 @@
 }
 
 is( HTML::FormFu::Model::HashRef::_unescape_name('foo\\_bar'), 'foo_bar' );
+
+is_deeply(
+    HTML::FormFu::Model::HashRef::_escape_hash(
+        {
+            'name_2'       => 'foo',
+            'name_bar_foo' => 'bar',
+            'name_2_bar'   => 'baz',
+            'name_2.bar'   => { 'bas_z' => 1 },
+            'bar_z'        => [ { foo_w => 1, foo_2 => 2 } ],
+        }
+    ),
+    {
+        'name_2'           => 'foo',
+        'name\\_bar\\_foo' => 'bar',
+        'name\\_2\\_bar'   => 'baz',
+        'name_2.bar'       => { 'bas\\_z' => 1 },
+        'bar\\_z'          => [ { 'foo\\_w' => 1, foo_2 => 2 } ]
+    }
+);
+
+is_deeply(
+    HTML::FormFu::Model::HashRef::_unescape_hash(
+        {
+            'name_2'           => 'foo',
+            'name\\_bar\\_foo' => 'bar',
+            'name\\_2\\_bar'   => 'baz',
+            'name_2.bar'       => { 'bas\\_z' => 1 },
+            'bar\\_z'          => [ { 'foo\\_w' => 1, foo_2 => 2 } ]
+
+        }
+    ),
+    {
+        'name_2'       => 'foo',
+        'name_bar_foo' => 'bar',
+        'name_2_bar'   => 'baz',
+        'name_2.bar'   => { 'bas_z' => 1 },
+        'bar_z'        => [ { foo_w => 1, foo_2 => 2 } ],
+    }
+);
+
+my $form = HTML::FormFu->new;
+$form->populate(
+    {
+        elements =>
+          [ { name => 'foo' }, { name => 'bar' }, { name => 'foo_bar' } ]
+    }
+);
+$form->process( { foo => 1, bar => 2, foo_bar => 3 } );
+
+is_deeply($form->model('HashRef')->create, { foo => 1, bar => 2, foo_bar => 3 });
+
+done_testing;




More information about the Pkg-perl-cvs-commits mailing list