]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole.pm
fixed bug with multiple template roots in TT, fixed bug with frontpage path of /...
[maypole.git] / lib / Maypole.pm
index b9a608518ff8d6d12ed46b0704f003293fe662a3..858437e39fadc75d1a4ab6ea3543ab5be58f513d 100644 (file)
@@ -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() );
@@ -476,7 +476,6 @@ sub component {
 
     $self->get_user;
     my $url = URI->new($path);
-    warn "path : $path\n";
     $self->{path} = $url->path;
     $self->parse_path;
     $self->params( $url->query_form_hash );
@@ -536,15 +535,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<Currently undocumented and liable to be refactored without warning>.
-
 =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 +688,15 @@ want to use something like Log::Log4perl instead.
 
 sub warn { }
 
+=item 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
@@ -979,10 +985,13 @@ sub parse_path
     # conditionally, broke lots of tests, hence this:
     $self->$_(undef) for qw/action table args/;
     $self->preprocess_path;
-    $self->path || $self->path('frontpage');
 
-    my @pi = grep {length} split '/', $self->path;
+    # use frontpage template for frontpage
+    unless ($self->path && $self->path ne '/') {
+      $self->path('frontpage');
+    }
 
+    my @pi = grep {length} split '/', $self->path;
 
     $self->table  || $self->table(shift @pi);
     $self->action || $self->action( shift @pi or 'index' );