X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole.pm;h=b08edbda68cdbf10c1493cbfd4e24c629f8ed6ea;hb=70a0d09c3f228f792775b4ac03894d0d37b5c444;hp=c970d01c0de485f7bc4fa1f506f75d75a5682c2f;hpb=427f0f2ec634f60fa90e60f5d3a048b6e1fc5f8b;p=maypole.git diff --git a/lib/Maypole.pm b/lib/Maypole.pm index c970d01..b08edbd 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -184,7 +184,7 @@ __PACKAGE__->mk_classdata($_) for qw( config init_done view_object model_classes __PACKAGE__->mk_accessors( qw( params query objects model_class template_args output path args action template error document_encoding content_type table - headers_in headers_out stash status parent) + headers_in headers_out stash status parent build_form_elements) ); __PACKAGE__->config( Maypole::Config->new() ); @@ -536,15 +536,13 @@ sub __call_hook This is the main request handling method and calls various methods to handle the request/response and defines the workflow within Maypole. -B. - =cut # The root of all evil sub handler_guts { my ($self) = @_; - + $self->build_form_elements(1); $self->__load_request_model; my $applicable = $self->is_model_applicable == OK; @@ -691,6 +689,15 @@ want to use something like Log::Log4perl instead. sub warn { } +=head2 build_form_elements + +$r->build_form_elements(0); + +Specify whether to build HTML form elements and populate +the cgi element of classmetadata. + +=cut + =item get_request You should only need to define this method if you are writing a new @@ -808,9 +815,9 @@ sub is_model_applicable { if (not $ok) { - warn "We don't have that table ($table).\n" + $self->warn ("We don't have that table ($table).\n" . "Available tables are: " - . join( ",", keys %$ok_tables ) + . join( ",", keys %$ok_tables )) if $self->debug and not $ok_tables->{$table}; return DECLINED; @@ -820,7 +827,7 @@ sub is_model_applicable { my $action = $self->action; return OK if $self->model_class->is_public($action); - warn "The action '$action' is not applicable to the table '$table'" + $self->warn("The action '$action' is not applicable to the table '$table'") if $self->debug; return DECLINED;