X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole.pm;h=087f2b9daae744671f8cf3af72cd4886531edab8;hb=394a7a18e5ed1231ae53c52690bd602b49328c66;hp=c31798d62ada1b0555a8cb338babed145df71232;hpb=4a8ca505c7550ed92d136b71824e29cd8a13ce44;p=maypole.git diff --git a/lib/Maypole.pm b/lib/Maypole.pm index c31798d..087f2b9 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -38,7 +38,7 @@ The canonical example used in the Maypole documentation is the beer database: $config->uri_base("http://localhost/beerdb"); $config->template_root("/path/to/templates"); $config->rows_per_page(10); - $config->display_tables([qw[beer brewery pub style]]); + $config->display_tables([qw/beer brewery pub style/]); # table relationships $config->relationships([ @@ -76,8 +76,8 @@ application. This is the C package used as an example in the manual. This needs to first use L which will make your package inherit from the appropriate platform driver such as C or -C. Then, the driver calls C. This sets up the model classes and -configures your application. The default model class for Maypole uses +C. Then, the driver calls C. This sets up the model classes +and configures your application. The default model class for Maypole uses L to map a database to classes, but this can be changed by altering configuration (B calling setup.) @@ -199,7 +199,7 @@ __PACKAGE__->mk_classdata($_) for qw( config init_done view_object ); __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 session) + headers_in headers_out stash session user) ); __PACKAGE__->config( Maypole::Config->new() ); @@ -210,7 +210,7 @@ __PACKAGE__->init_done(0); As a framework, Maypole provides a number of B - methods that are intended to be overridden. Some of these methods come with useful default -behaviour, others do nothing by default. Likely hooks include: +behaviour, others do nothing by default. Hooks include: Class methods ------------- @@ -431,11 +431,13 @@ sub handler : method $self->get_request($req); $self->parse_location; - # hook useful for declining static requests e.g. images + # hook useful for declining static requests e.g. images, or perhaps for + # sanitizing request parameters my $status = $self->start_request_hook; return $status unless $status == Maypole::Constants::OK(); $self->session($self->get_session); + $self->user($self->get_user); $status = $self->handler_guts; @@ -690,12 +692,30 @@ sub is_model_applicable =item get_session +Called immediately after C. + +This method should return a session, which will be stored in the request's +C attribute. + The default method is empty. =cut sub get_session { } +=item get_user + +Called immediately after C. + +This method should return a user, which will be stored in the request's C +attribute. + +The default method is empty. + +=cut + +sub get_user {} + =item call_authenticate This method first checks if the relevant model class @@ -1199,7 +1219,7 @@ calls during processing of a request. This is a brief summary: | | | |-----+ init | | ||<---+ | | - || | new | view_object: e.g + || | new | view_object: e.g. ||---------------------------------------------> Maypole::View::TT | | | | | | | | @@ -1229,6 +1249,9 @@ calls during processing of a request. This is a brief summary: | ||-----+ get_session | | | | |||<---+ | | | | || | | | + | ||-----+ get_user | | | + | |||<---+ | | | + | || | | | | ||-----+ handler_guts | | | | |||<---+ | | | | ||| class_of($table) | | | @@ -1244,14 +1267,14 @@ calls during processing of a request. This is a brief summary: | ||| | | | | |||-----+ additional_data | | | | ||||<---+ | | | - | ||| process | | fetch_objects - | |||--------------------------------->||-----+ | + | ||| process | | | + | |||--------------------------------->|| fetch_objects + | ||| | ||-----+ | | ||| | |||<---+ | | ||| | || | | ||| | || $action | ||| | ||-----+ | - | ||| | |||<---+ | - | ||| | | | + | ||| | |||<---+ | | ||| process | | | | |||------------------------------------------->|| template | ||| | | ||-----+