From 9de2e5c0ad43b2983e4aa02215685b69fd15d357 Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Wed, 8 Sep 2004 18:04:17 +0000 Subject: [PATCH] Config parameter handling for Maypole::Model::CDBI git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@169 48953598-375a-da11-a14b-00016c27c3ee --- Changes | 2 +- TODO | 5 +++-- lib/Maypole.pm | 4 ++-- lib/Maypole/Model/CDBI.pm | 4 ++++ 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index ff7b9be..2d0b1a3 100644 --- a/Changes +++ b/Changes @@ -19,7 +19,7 @@ Revision history for Perl extension Maypole 1.5 Mon Jun 21 14:36:54 BST 2004 - CLI mode correctly uses Constants module - Template footers as well as headers (Markus Ramberg) - - Fix problems on failed object create (Jesse Shiedlower) + - Fix problems on failed object create (Jesse Sheidlower) - Fix related() to deal with latest version of Class::DBI (Markus) - Add sample CSS to distribution - Maypole::Model::CDBI::Plain, for those who already have a CDBI set diff --git a/TODO b/TODO index 3444d0c..941c957 100644 --- a/TODO +++ b/TODO @@ -1,2 +1,3 @@ -See http://wiki.simon-cozens.org/?MaypoleToDo - +* Tests +* Better Documentation and more complex examples +* Make templates XHTML compliant diff --git a/lib/Maypole.pm b/lib/Maypole.pm index e3a9252..e804901 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -67,7 +67,7 @@ sub handler_guts { unless ($applicable == OK) { # It's just a plain template delete $r->{model_class}; - $r->{path} =~ s{/}{}; # De-absolutify + $r->{path} =~ s{/$}{}; # De-absolutify $r->template($r->{path}); } # We authenticate every request, needed for proper session management @@ -283,7 +283,7 @@ Simon Cozens, C =head1 THANK YOU -Jesse Scheildlower, Jody Belka, Markus Ramberg, Mickael Joanne, Simon Flack and all the others who've helped. +Jesse Scheidlower, Jody Belka, Markus Ramberg, Mickael Joanne, Simon Flack and all the others who've helped. =head1 LICENSE diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index 825d752..2a79850 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -132,6 +132,10 @@ sub list :Exported { sub setup_database { my ($self, $config, $namespace, $dsn, $u, $p, $opts) = @_; + $dsn ||= $config->{dsn}; + $u ||= $config->{user}; + $p ||= $config->{pass}; + $opts ||= $config->{opts}; $config->{dsn} = $dsn; $config->{loader} = Class::DBI::Loader->new( namespace => $namespace, -- 2.39.5