lib/spiderfw/widget/widget.rb in spiderfw-0.6.1 vs lib/spiderfw/widget/widget.rb in spiderfw-0.6.2
- old
+ new
@@ -115,11 +115,11 @@
end
def template_path
return @template_path if @template_path
@template_path = @widget_path
- @template_path += '/templates' if ::File.directory?(@template_path+'/templates')
+ @template_path += '/templates' if @template_path && ::File.directory?(@template_path+'/templates')
@template_path
end
def default_template(val=nil)
@default_template = val if val
@@ -552,9 +552,10 @@
def transient_session
return session(@request.session.transient, Spider::TransientHash)
end
def create_widget(klass, id, *params)
+ klass = Spider::Template.get_registered_class(klass) unless klass.is_a?(Class)
params.unshift(@response)
params.unshift(@request)
obj = klass.new(*params)
obj.id = id
add_widget(obj)