[Maypole] Maypole 'search' action and CDBI 'search' method

From: Dave Howorth (Dave.Howorth at acm.org)
Date: Sun Feb 13 2005 - 17:44:28 GMT


There's a rather ugly line at the start of Maypole::Model::CDBI->search():

sub search : Exported {
     return shift->SUPER::search(@_) if caller ne "Maypole::Model::Base";

It's there, AFAIK, because this search method overrides the search
method that was inherited from Class::DBI, but we still need access to
Class::DBI's method in order to actually search the database.

That hardwired class name has always looked wrong to me, and I may
finally have a concrete reason why. I'm writing a new action in my
subclass that basically comes down to setting up some values in
$r->{params} and calling my/Maypole's search action. This fails, because
my subclass is not Maypole::Model::Base of course so the super/CDBI
method is invoked by the troublesome line, which is not what I want.

So I believe a better means of distinguishing the Maypole action from
the CDBI method is needed. We could change the test to check whether the
first arg is an object (the Maypole request) or a string (a CDBI column
name) but I would prefer to eliminate the need for the test altogether
by renaming the Maypole action to 'do_search' and changing the templates
(list, pager & search_form) to use the new action name.

Or is there some better solution that I'm overlooking?

BTW, there's a similar hack in the delete action that we ought to fix at
the same time, IMHO.

Cheers, Dave

-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.7 - Release Date: 10/02/05

_______________________________________________ maypole mailing list maypole at lists.netthink.co.uk http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:58 GMT