[Catalyst-commits] r7871 - in
CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk: .
lib/CatalystX/CRUD/Controller
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Fri May 30 18:56:51 BST 2008
Author: karpet
Date: 2008-05-30 18:56:48 +0100 (Fri, 30 May 2008)
New Revision: 7871
Modified:
CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/lib/CatalystX/CRUD/Controller/RHTMLO.pm
Log:
set $c into forms app() attribute at instatiation time as well as on each request
Modified: CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/Changes 2008-05-30 13:25:38 UTC (rev 7870)
+++ CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/Changes 2008-05-30 17:56:48 UTC (rev 7871)
@@ -44,3 +44,7 @@
* use Class::C3
* prime object as well as form in create()
+0.12 30 May 2008
+ * pass $c in to form->new() as value to 'app' param, as well as setting in in app() method.
+ this is so that $c is available to build_form() et al.
+
Modified: CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/lib/CatalystX/CRUD/Controller/RHTMLO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/lib/CatalystX/CRUD/Controller/RHTMLO.pm 2008-05-30 13:25:38 UTC (rev 7870)
+++ CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/lib/CatalystX/CRUD/Controller/RHTMLO.pm 2008-05-30 17:56:48 UTC (rev 7871)
@@ -4,7 +4,7 @@
use Carp;
use Class::C3;
-our $VERSION = '0.11';
+our $VERSION = '0.12';
=head1 NAME
@@ -53,15 +53,15 @@
}
}
-=head2 form( [ I<context> ] )
+=head2 form( I<context> )
Returns an instance of config->{form_class}.
A single form object is instantiated and cached in the controller object.
The form's clear() method is called before returning.
-If I<context> object is passed it is stashed via the forms's app() method.
+I<context> object is set in forms's app() method.
B<NOTE:> The form is cleared only the B<first time>
-form() is called in each request cycle, and only if I<content> is present.
+form() is called in each request cycle.
This is B<different> than the behaviour described in
CatalystX::CRUD::Controller.
@@ -69,11 +69,9 @@
sub form {
my ( $self, $c ) = @_;
- $self->{_form} ||= $self->form_class->new;
- if ($c) {
- $self->{_form}->clear unless $c->stash->{_form_called}++;
- $self->{_form}->app($c);
- }
+ $self->{_form} ||= $self->form_class->new( app => $c );
+ $self->{_form}->app($c) unless defined $self->{_form}->app;
+ $self->{_form}->clear unless $self->{_form}->app->stash->{_form_called}++;
return $self->{_form};
}
More information about the Catalyst-commits
mailing list