Index: /trunk/app/helpers/hyperde/node.rb
===================================================================
--- /trunk/app/helpers/hyperde/node.rb	(revision 39)
+++ /trunk/app/helpers/hyperde/node.rb	(revision 47)
@@ -9,10 +9,16 @@
     
   def attr(attr_name, template = nil, &block)
-    value = @node.send(attr_name) rescue nil
-    if value.nil?
-      ""
-    else
-      attr_value(value, attr_name, template, &block)      
+    value = ""
+    begin
+        value = @node.send(attr_name)
+        if value.nil?
+          ""
+        else
+          attr_value(value, attr_name, template, &block)      
+      end
+    rescue => ex
+        value = ex.to_s
     end
+    value
   end
 
Index: /trunk/app/helpers/navigation_helper.rb
===================================================================
--- /trunk/app/helpers/navigation_helper.rb	(revision 39)
+++ /trunk/app/helpers/navigation_helper.rb	(revision 47)
@@ -11,257 +11,261 @@
   end
   
-	def render_node_attribute(attr, node)
-	  buffer = ""
-	  buffer_label = ""
-	  value = node.send(attr.name)
-		if value && value.to_s.strip.length > 0
-			case attr
-			when IndexNavAttribute
-			  buffer_label << "<hr/>"
-				buffer << render_index(value) if value.entries.length > 0
-			when AnchorNavAttribute
-			  buffer << render_node_anchor(value)
-			else
-			  case attr.data_type.strip.downcase
-				when "image"
-					buffer << "<img src=\"#{value.to_s}\"/>"
-				when "url", "uri"
-					buffer << "<a href=\"#{value.to_s}\" target=\"_blank\">#{value.to_s}</a>"
-				when "email"
-					buffer << "<a href=\"mailto:#{value.to_s}\" target=\"_blank\">#{value.to_s}</a>"
-				else
-				  buffer << value.to_s
-				end
-			end
-		end
-		if buffer.length > 0
-		  buffer_label << "<span class=node_attribute_label>"
-		  buffer_label << NavAttribute.human_attribute_name(attr.name)
-		  buffer_label << ":&nbsp;</span><span class=node_attribute_value>"
-		  buffer = buffer_label + buffer
-		  buffer << "</span>"
-		end
-		buffer
-	end
-	
-	def render_node_attributes(node)
-	  buffer = ""
-	  buffer << "<div class=node_attribute>"
-	  buffer << "<span class=node_attribute_label>Id:</span>&nbsp;"
-	  buffer << "<span class=node_attribute_value>#{node.id}</span>"
-	  buffer << "</div>"
-	  attrs = node.nav_attributes.values
-	  attrs.sort! { |a,b| ((a.order * 10) + (a.position ? a.position : 0) ) <=> ((b.order * 10) + (b.position ? b.position : 0) ) } 
-		for attr in attrs
-		  buf_value = render_node_attribute(attr, node)
-		  buffer << "<div class=node_attribute>" << buf_value << "</div>" if buf_value.length > 0
-		end
-		buffer
-	end
-
-	def action_for_anchor(anc)
-	  case anc
-	  when ContextAnchorValue
-			"context"
-		when IndexAnchorValue
-		  "show_index"
-		else
-		  nil
-		end
-	end
-	  	
+  def render_node_attribute(attr, node)
+    buffer = ""
+    buffer_label = ""
+    begin
+      value = node.send(attr.name)
+      if value && value.to_s.strip.length > 0
+        case attr
+        when IndexNavAttribute
+          buffer_label << "<hr/>"
+          buffer << render_index(value) if value.entries.length > 0
+        when AnchorNavAttribute
+          buffer << render_node_anchor(value)
+        else
+          case attr.data_type.strip.downcase
+          when "image"
+            buffer << "<img src=\"#{value.to_s}\"/>"
+          when "url", "uri"
+            buffer << "<a href=\"#{value.to_s}\" target=\"_blank\">#{value.to_s}</a>"
+          when "email"
+            buffer << "<a href=\"mailto:#{value.to_s}\" target=\"_blank\">#{value.to_s}</a>"
+          else
+            buffer << value.to_s
+          end
+        end
+      end
+    rescue => ex
+      buffer = ex.to_s
+    end
+    if buffer.length > 0
+      buffer_label << "<span class=node_attribute_label>"
+      buffer_label << NavAttribute.human_attribute_name(attr.name)
+      buffer_label << ":&nbsp;</span><span class=node_attribute_value>"
+      buffer = buffer_label + buffer
+      buffer << "</span>"
+    end
+    buffer
+  end
+  
+  def render_node_attributes(node)
+    buffer = ""
+    buffer << "<div class=node_attribute>"
+    buffer << "<span class=node_attribute_label>Id:</span>&nbsp;"
+    buffer << "<span class=node_attribute_value>#{node.id}</span>"
+    buffer << "</div>"
+    attrs = node.nav_attributes.values
+    attrs.sort! { |a,b| ((a.order * 10) + (a.position ? a.position : 0) ) <=> ((b.order * 10) + (b.position ? b.position : 0) ) } 
+    for attr in attrs
+      buf_value = render_node_attribute(attr, node)
+      buffer << "<div class=node_attribute>" << buf_value << "</div>" if buf_value.length > 0
+    end
+    buffer
+  end
+
+  def action_for_anchor(anc)
+    case anc
+    when ContextAnchorValue
+      "context"
+    when IndexAnchorValue
+      "show_index"
+    else
+      nil
+    end
+  end
+      
   def render_node_anchor(anc)
-		action = action_for_anchor(anc)	    
-		anchor_url = link_to(anc.label_value, :action => action, :id => anc.target_id, :params => params_for_anchor(anc.params_values)) if anc.target_id
-		buffer = ""
-		buffer << "<span class=node_anchor_link>" << anchor_url << "<span>" if anchor_url
-		buffer
-	end
-
-	def action_for_index_entry_attribute(attr)
-		case attr
-		when ContextAnchorIndexEntryAttribute
-			"context"
-		when IndexAnchorIndexEntryAttribute
-			"show_index"
-		else
-			nil
-		end
-	end
-
-	def params_for_anchor(*params)
-	  ret = []
-	  params.each { |p| ret << p if p } if params
-	  { :p => ret.length == 0 ? nil : ret.join(',') }
-	end
-	
-	def render_index_entry(entry, params = nil, truncate_by = nil)
-	  buffer = ""
-	  for attr in entry.index_attributes
-	    action = action_for_index_entry_attribute(attr)
-			buffer << "<td class=index_entry_attribute>"
-			if action
-			  buffer << link_to(truncate_by ? truncate(attr.label_value, truncate_by) : attr.label_value, \
-			                    :controller => "navigation", \
-												  :action => action, :id => attr.target_id, \
-												  :params => params_for_anchor(attr.params_values, params) )
-			else
-				buffer << attr.label_value.to_s
-			end
-			buffer << "</td>"
-		end
-		buffer
-	end
-										 
-	def render_index(idx, params = nil, selected = nil, limit = nil, truncate_by = nil)
-	  buffer = ""
-	  buffer << "<table class=index_table><th class=index_header><thead><tr>"
-	  for attr in idx.index_attributes
-	    buffer << "<th>#{IndexAttribute.human_attribute_name(attr.name)}</th>" 
-		end
-		buffer << "</tr></thead><tbody>"
-		entries = idx.entries
-		if selected and limit
-		  lbound = selected - limit
-		  ubound = selected + limit 
-		  if lbound < 0
-		    ubound -= lbound
-		    lbound = 0
-			elsif ubound > entries.length-1
-			  lbound -= (ubound - entries.length-1)
-			  ubound = entries.length-1
-			end
-			lbound = 0 if lbound < 0
-		  ubound = entries.length-1 if ubound > entries.length-1
-		else
-		  lbound = 0
-		  ubound = entries.length-1
-		end
-		
-		if lbound > 0
-		  buffer << "<tr class=index_entry><td>...</td></tr>"
-		end
-		
-		i=lbound
-		for entry in entries[lbound..ubound]
-			buffer << "<tr class=index_entry"
-			buffer << (i == selected ? "_selected>" : ">")
-			buffer << render_index_entry(entry, params, truncate_by)
-			buffer << "</tr>"
-			i += 1
-		end
-		
-		if ubound < entries.length-1
-		  buffer << "<tr class=index_entry><td>...</td></tr>"
-		end
-		
-		buffer << "</tbody></table>"
-	  buffer
-	end
-
-	def render_context_index(context)
-	  buffer = ""
+    action = action_for_anchor(anc)	    
+    anchor_url = link_to(anc.label_value, :action => action, :id => anc.target_id, :params => params_for_anchor(anc.params_values)) if anc.target_id
+    buffer = ""
+    buffer << "<span class=node_anchor_link>" << anchor_url << "<span>" if anchor_url
+    buffer
+  end
+
+  def action_for_index_entry_attribute(attr)
+    case attr
+    when ContextAnchorIndexEntryAttribute
+      "context"
+    when IndexAnchorIndexEntryAttribute
+      "show_index"
+    else
+      nil
+    end
+  end
+
+  def params_for_anchor(*params)
+    ret = []
+    params.each { |p| ret << p if p } if params
+    { :p => ret.length == 0 ? nil : ret.join(',') }
+  end
+  
+  def render_index_entry(entry, params = nil, truncate_by = nil)
+    buffer = ""
+    for attr in entry.index_attributes
+      action = action_for_index_entry_attribute(attr)
+      buffer << "<td class=index_entry_attribute>"
+      if action
+        buffer << link_to(truncate_by ? truncate(attr.label_value, truncate_by) : attr.label_value, \
+                          :controller => "navigation", \
+                          :action => action, :id => attr.target_id, \
+                          :params => params_for_anchor(attr.params_values, params) )
+      else
+        buffer << attr.label_value.to_s
+      end
+      buffer << "</td>"
+    end
+    buffer
+  end
+                     
+  def render_index(idx, params = nil, selected = nil, limit = nil, truncate_by = nil)
+    buffer = ""
+    buffer << "<table class=index_table><th class=index_header><thead><tr>"
+    for attr in idx.index_attributes
+      buffer << "<th>#{IndexAttribute.human_attribute_name(attr.name)}</th>" 
+    end
+    buffer << "</tr></thead><tbody>"
+    entries = idx.entries
+    if selected and limit
+      lbound = selected - limit
+      ubound = selected + limit 
+      if lbound < 0
+        ubound -= lbound
+        lbound = 0
+      elsif ubound > entries.length-1
+        lbound -= (ubound - entries.length-1)
+        ubound = entries.length-1
+      end
+      lbound = 0 if lbound < 0
+      ubound = entries.length-1 if ubound > entries.length-1
+    else
+      lbound = 0
+      ubound = entries.length-1
+    end
+    
+    if lbound > 0
+      buffer << "<tr class=index_entry><td>...</td></tr>"
+    end
+    
+    i=lbound
+    for entry in entries[lbound..ubound]
+      buffer << "<tr class=index_entry"
+      buffer << (i == selected ? "_selected>" : ">")
+      buffer << render_index_entry(entry, params, truncate_by)
+      buffer << "</tr>"
+      i += 1
+    end
+    
+    if ubound < entries.length-1
+      buffer << "<tr class=index_entry><td>...</td></tr>"
+    end
+    
+    buffer << "</tbody></table>"
+    buffer
+  end
+
+  def render_context_index(context)
+    buffer = ""
     buffer << render_index(context.index, @params[:p], context.position, 9, 20)
-		buffer
-	end
-
-	def render_params(params)
-	  buffer = ""
-	  for param in params
-	    buffer << ", " if buffer.length > 0
-	    buffer << "#{param[:name]}=#{param[:value]}"
-		end
-		buffer = "(" + buffer + ")" if buffer.length > 0
-		buffer
-	end
-	
-	def render_context_navigation(context)
-		buffer = render_context_previous_anchor(context)
-		buffer << render_context_next_anchor(context)
-		buffer
-	end
-	
-	def render_context_previous_anchor(context)
-	  buffer = "<span id=previous_link>"
-	  if !context.on_first?
-	    buffer << link_to("<< #{truncate(context.previous.label)}", 
-	                      :controller => "navigation", :action => "context", 
-	                      :id => "#{Context.full_id(context,context.position-1)}", 
-	                      :params => params_for_anchor(@params[:p]) )
-		else
-		  buffer << "&nbsp;"
-		end
-		buffer << "</span>"
-		buffer
-	end
-	
-	def render_context_next_anchor(context)
-		buffer = "<span id=next_link>"
-	  if !context.on_last?
-	  	buffer << link_to("#{truncate(context.next.label)} >>", :controller => "navigation", :action => "context", :id => "#{Context.full_id(context,context.position+1)}", :params => params_for_anchor(@params[:p]) )
-    else
-	   buffer << "&nbsp;"
-	  end
-		buffer << "</span>"
-		buffer
-	end
-
-	def render_landmark(lm)
-	  buffer = "[<span class=landmark>"
-	  action = action_for_landmark(lm)
-		buffer << link_to(lm.label_value, :action => action, :id => lm.target_id, :params => params_for_anchor(lm.params_values))
-		buffer << "</span>]&nbsp;"
-	end
-	
-	def render_landmarks(landmarks)
-		buffer = ""
-		for lm in landmarks
-			buffer << render_landmark(lm)
-		end
-		buffer
-	end
-
-	def render_breadcrumb(separator = nil)
-	  return "" if @breadcrumb.nil?
-	  buffer = ""
-	  @breadcrumb.entries.each do |bc|
-	    buffer << separator if separator
-	    buffer << "<span class=breadcrumb_item>"
-	    buffer << link_to(truncate(bc["title"]), :action => bc["action"], :id => bc["id"], :params => params_for_anchor(bc[:p]))
-	    buffer << "</span>"
-		end	
-		buffer			    
-	end
-
-	def render_actions
-	  buffer = ""
-	  class_name = node_id = nil
-
-	  if @params["action"] == "context"
-	    class_name = @context.current.class.name
-	    node_id = @context.current.id
-		end
-				
-	  context_actions = [ { :title => "Edit this #{class_name}", :action => "edit" }, \
-	                       { :title => "Delete this #{class_name}", :action => "delete"}, \
-	                       { :title => "Add New #{class_name}", :action => "new" } ]
- 	  global_actions = [{ :title => "Add New Node (Any Class)", :action => "select_class" }, \
- 	                     { :title => "Go to Metamodel", :controller => "nav_class", :action => "list" } ]
-
-		@params["action"] == "context" ? actions = context_actions + global_actions : actions = global_actions
-		     
-	  for action in actions
-			node_id = nil if action[:action] == "select_class"	    
-	    buffer << "&nbsp;<span class=action>["
-	    buffer << link_to(action[:title], :controller => action[:controller] ? action[:controller] : "node", \
-	                      :action => action[:action], :id => node_id, \
-	                      :params => { "return_to" => url_for( :controller => @params["controller"], \
-	                                                  :action => @controller.action_name, \
-	                                                  :id => @params["id"], \
-	                                                  :params => { :p => @params[:p] } ) } )
-	    buffer << "]</span>"
-		end
-		buffer
-	end
+    buffer
+  end
+
+  def render_params(params)
+    buffer = ""
+    for param in params
+      buffer << ", " if buffer.length > 0
+      buffer << "#{param[:name]}=#{param[:value]}"
+    end
+    buffer = "(" + buffer + ")" if buffer.length > 0
+    buffer
+  end
+  
+  def render_context_navigation(context)
+    buffer = render_context_previous_anchor(context)
+    buffer << render_context_next_anchor(context)
+    buffer
+  end
+  
+  def render_context_previous_anchor(context)
+    buffer = "<span id=previous_link>"
+    if !context.on_first?
+      buffer << link_to("<< #{truncate(context.previous.label)}", 
+                        :controller => "navigation", :action => "context", 
+                        :id => "#{Context.full_id(context,context.position-1)}", 
+                        :params => params_for_anchor(@params[:p]) )
+    else
+      buffer << "&nbsp;"
+    end
+    buffer << "</span>"
+    buffer
+  end
+  
+  def render_context_next_anchor(context)
+    buffer = "<span id=next_link>"
+    if !context.on_last?
+      buffer << link_to("#{truncate(context.next.label)} >>", :controller => "navigation", :action => "context", :id => "#{Context.full_id(context,context.position+1)}", :params => params_for_anchor(@params[:p]) )
+    else
+     buffer << "&nbsp;"
+    end
+    buffer << "</span>"
+    buffer
+  end
+
+  def render_landmark(lm)
+    buffer = "[<span class=landmark>"
+    action = action_for_landmark(lm)
+    buffer << link_to(lm.label_value, :action => action, :id => lm.target_id, :params => params_for_anchor(lm.params_values))
+    buffer << "</span>]&nbsp;"
+  end
+  
+  def render_landmarks(landmarks)
+    buffer = ""
+    for lm in landmarks
+      buffer << render_landmark(lm)
+    end
+    buffer
+  end
+
+  def render_breadcrumb(separator = nil)
+    return "" if @breadcrumb.nil?
+    buffer = ""
+    @breadcrumb.entries.each do |bc|
+      buffer << separator if separator
+      buffer << "<span class=breadcrumb_item>"
+      buffer << link_to(truncate(bc["title"]), :action => bc["action"], :id => bc["id"], :params => params_for_anchor(bc[:p]))
+      buffer << "</span>"
+    end	
+    buffer			    
+  end
+
+  def render_actions
+    buffer = ""
+    class_name = node_id = nil
+
+    if @params["action"] == "context"
+      class_name = @context.current.class.name
+      node_id = @context.current.id
+    end
+        
+    context_actions = [ { :title => "Edit this #{class_name}", :action => "edit" }, \
+                         { :title => "Delete this #{class_name}", :action => "delete"}, \
+                         { :title => "Add New #{class_name}", :action => "new" } ]
+    global_actions = [{ :title => "Add New Node (Any Class)", :action => "select_class" }, \
+                       { :title => "Go to Metamodel", :controller => "nav_class", :action => "list" } ]
+
+    @params["action"] == "context" ? actions = context_actions + global_actions : actions = global_actions
+         
+    for action in actions
+      node_id = nil if action[:action] == "select_class"	    
+      buffer << "&nbsp;<span class=action>["
+      buffer << link_to(action[:title], :controller => action[:controller] ? action[:controller] : "node", \
+                        :action => action[:action], :id => node_id, \
+                        :params => { "return_to" => url_for( :controller => @params["controller"], \
+                                                    :action => @controller.action_name, \
+                                                    :id => @params["id"], \
+                                                    :params => { :p => @params[:p] } ) } )
+      buffer << "]</span>"
+    end
+    buffer
+  end
 end
 
