- improved exception handling
- now uses File::MMagic::XS to guess mime type of output unless already set
- new component method provides Maypole::Component functionality
+ - new object method gets/sets first/only object in objects
Maypole::Model
- do_delete, do_search in place of delete/search actions
Maypole::View::TT:
class, it will be removed from C<args> and the retrieved object will be added to
the C<objects> list. See L<Maypole::Model> for more information.
+
+=item object
+
+Alias to get/set the first/only model object. The object will be accessible
+in the view templates.
+
+When used to set the object, will overwrite the request objects
+with a single object.
+
+=cut
+
+sub object {
+ my ($r,$object) = @_;
+ $r->objects([$object]) if ($object);
+ return undef unless $r->objects();
+ return $r->objects->[0];
+}
+
=item template_args
$self->template_args->{foo} = 'bar';
=item stash
-A place to put custom application data. Not used by Maypole itself.
+A place to put custom application data. Not used by Maypole itself.
=item template
}
if ($tt->process(\$error_template,
{ err_type => $type, error => $error,
- config => { (%{$r->{config}}) },
- request => $r, # We have that at least
+ config => $r->{config},
+ request => $r,
eval{$self->vars($r)} }, \$output )) {
$r->{output} = $output;
if ($tt->error) { $r->{output} = "<html><body>Even the error template
<h2> Request details </h2>
-<table>
- [% FOR thing = ["model_class", "table", "template", "path",
+<table>
+ [% FOR attribute = ["model_class", "table", "template", "path",
"content_type", "document_encoding", "action", "args", "objects"] %]
- <tr> <td class="lhs"> [%thing %] </td> <td class="rhs"> [%
- request.$thing.list.join(" , ") %] </td></tr>
+ <tr> <td class="lhs"> [% attribute %] </td> <td class="rhs"> [%
+ request.$attribute.list.join(" , ") %] </td></tr>
[% END %]
</table>
<h2> Application configuration </h2>
-<table>
- [% FOR thing = config.keys %]
- <tr> <td class="lhs"> [%thing %] </td> <td class="rhs"> [%
- config.$thing.list.join(" , ") %] </td></tr>
+<table>
+ [% FOR field IN config %]
+ <tr> <td class="lhs"> [% field.key %] </td> <td class="rhs"> [%
+ $field.value.list.join(" , ") %] </td></tr>
[% END %]
</table>