From 1194fb590c7566bf936be64155db24275e263ff6 Mon Sep 17 00:00:00 2001 From: Aaron Trevena Date: Mon, 13 Mar 2006 15:15:23 +0000 Subject: [PATCH] updated MANIFEST git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@465 48953598-375a-da11-a14b-00016c27c3ee --- MANIFEST | 2 ++ META.yml | 5 ++++- lib/Maypole.pm | 2 +- lib/Maypole/Model/CDBI.pm | 11 ++++++++++- lib/Maypole/templates/factory/edit | 31 +++++++++++++++++++++++++++++- 5 files changed, 47 insertions(+), 4 deletions(-) diff --git a/MANIFEST b/MANIFEST index e613d81..ea6ab4e 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1,5 +1,7 @@ Changes ex/BeerDB.pm +ex/BeerDB/Base.pm +ex/BeerDB/Beer.pm ex/beerdb.sql lib/Apache/MVC.pm lib/CGI/Maypole.pm diff --git a/META.yml b/META.yml index 5188168..aa93104 100644 --- a/META.yml +++ b/META.yml @@ -6,7 +6,9 @@ version_from: lib/Maypole.pm installdirs: site requires: CGI::Simple: 0 - CGI::Untaint: 0 + CGI::Untaint: 1.26 + CGI::Untaint::date: 0 + CGI::Untaint::email: 0 Class::DBI: 0.96 Class::DBI::AbstractSearch: 0 Class::DBI::AsForm: 2.2 @@ -15,6 +17,7 @@ requires: Class::DBI::Loader::Relationship: 0 Class::DBI::Pager: 0 Class::DBI::Plugin::RetrieveAll: 0 + Class::DBI::Plugin::Type: 0 Class::DBI::SQLite: 0 Digest::MD5: 0 File::MMagic::XS: 0.08 diff --git a/lib/Maypole.pm b/lib/Maypole.pm index ae2ae58..64e5a1a 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -592,7 +592,7 @@ sub handler_guts if ( my $error = $@ ) { $status = $self->call_exception($error, "model"); - if ( $status != OK ) + if ( $status != OK ) { warn "caught model error: $error"; return $self->debug ? diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index bd982e6..ae11c4d 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -100,11 +100,15 @@ sub do_edit : Exported { } undef $obj if $creating; + + die "do_update failed with error : $fatal" if ($fatal); $r->template("edit"); } else { $r->template("view"); } + + $r->objects( $obj ? [$obj] : []); } @@ -136,7 +140,10 @@ sub _do_update_or_create { }; if ($fatal = $@) { - warn "$fatal" if $r->debug; + warn "FATAL ERROR: $fatal" if $r->debug; +# $self->dbi_rollback; + } else { +# $self->dbi_commit; } $creating++; } @@ -173,7 +180,9 @@ sub delete : Exported { sub do_delete { my ( $self, $r ) = @_; + # FIXME: handle fatal error with exception $_->SUPER::delete for @{ $r->objects || [] }; +# $self->dbi_commit; $r->objects( [ $self->retrieve_all ] ); $r->{template} = "list"; $self->list($r); diff --git a/lib/Maypole/templates/factory/edit b/lib/Maypole/templates/factory/edit index 77dfa3a..14f77be 100644 --- a/lib/Maypole/templates/factory/edit +++ b/lib/Maypole/templates/factory/edit @@ -38,6 +38,35 @@ form similar to L but with the current values filled in. [% END %] [% ELSE %] -[% INCLUDE addnew %] + +
+
+
+Add a new [% classmetadata.moniker %] + [% FOR col = classmetadata.columns %] + [% NEXT IF col == "id" %] + + [% IF errors.$col %] + [% errors.$col | html %] + [% END %] + + [% END; %] + + +
+
+
+ [% END %] [% INCLUDE footer %] -- 2.39.5