def _template_for(context, content_type, controller=nil, opts={})
template_method = nil
template_location = nil
self.class._template_roots.reverse_each do |root, template_location|
if opts[:template]
template_location = root / self.send(template_location, opts[:template], content_type, nil)
template_method = Merb::Template.template_for(template_location)
break if template_method && self.respond_to?(template_method)
end
template_location = root / (opts[:template] || self.send(template_location, context, content_type, controller))
template_method = Merb::Template.template_for(template_location)
break if template_method && self.respond_to?(template_method)
end
[template_method, template_location]
end