[Maypole] Re: Maypole responding to requests very slowly (or, how to get just one associated record instead of getting the world)

Peter Speltz peterspeltz@yahoo.com
Fri, 3 Dec 2004 11:32:54 -0800 (PST)


--- Simon Flack <sf@flacks.net> wrote:

> 
> It just seems a little odd to me to alter the relationship between the 
> model and the view by setting a template variable. 

Well, when a gets relationship is dysfunctional sometimes you simply have to
spice it up a little. :) IMO, its changing it any but only making it better. 
Relationship is still -- View::Base is a good friend to Model and sets some
default template_args for it.  Models can override them.

>It feels more like a 
> hack than a proper solution. I don't mean any offence, we may have to go 
> with hacks for the short-term to preserve compatability. but I'd like to 
> know what the ideal solution would be first.

No offense. Its a hack.  If i could code the ideal solution on my own I would
have submitted a patch already  and not wasted my or others's time talking
about it :) Is there any chance of knowing the ideal solution soon , so we can
go ahead and start using it ?

> > In view, you don't want overhead of making cgi or list_columns say this:
> > sub view {
> >   ...
> >   $r->template_args{classmetadata__list_columns} = 1; 
> >   $r->template_args(classmetadata__cgi} = 1;
> > 
> >   .. .
> > }
> 
> That syntax looks quirky to me. I'd rather change Maypole::View::Base to 
> set each param individually than to add to the list of parameters that 
> we need to support.
> 

Not sure what you mean "add to list ... support".
If You mean something like do :  $classmetadata->{cgi} = $r->template_args{cgi}
|| $class->to_cgi -- I like that better too. 


> >>Maybe the whole classmetadata thing should be an object?
> >>
> > 
> > 
> > Can you give an example of how that would significantly improve things now?
> I
> > don't see how it would help but I wouldn't be surprised if it would. 
> 
> I'm not sure we need the extra complexity. Everything in 'classmetadata' 
> is already the result of a method call on $class.
> 
> We could just *always* provide classmetadata.name and make the rest of 
> it optional. Then you can call the methods you're interested in from 
> your template (e.g. with Template::Plugin::Class). And from the sound of 
> it, you can do the same in Mason without a plugin.
> 

This might be a good option on or off option for people who want max performance.

=====
pjs


		
__________________________________ 
Do you Yahoo!? 
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com