Changeset 35255 for platform/tdiary

Show
Ignore:
Timestamp:
09/09/09 02:30:44 (4 years ago)
Author:
machu
Message:

add error hundling (monkey patch)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/plugin/profile.rb

    r35251 r35255  
    4242      def parse_profile(f) 
    4343        doc = REXML::Document.new(f) 
    44         @name = doc.elements['//user/name'].text 
    45         @mail = doc.elements['//user/email'].text 
     44        @name = doc.elements['//user/name'].text if doc.elements['//user/name'] 
     45        @mail = doc.elements['//user/email'].text if doc.elements['//user/email'] 
    4646        # github uses gravater.com for user icon 
    4747        @image = "http://www.gravatar.com/avatar/#{Digest::MD5.hexdigest(@mail)}.jpg" 
     
    6767      def parse_profile(f) 
    6868        doc = REXML::Document.new(f) 
    69         @name = doc.elements['//user/name'].text 
    70         @image = doc.elements['//user/profile_image_url'].text 
    71         @description = doc.elements['//user/description'].text 
     69        @name = doc.elements['//user/name'].text if doc.elements['//user/name'] 
     70        @image = doc.elements['//user/profile_image_url'].text if doc.elements['//user/profile_image_url'] 
     71        @description = doc.elements['//user/description'].text if doc.elements['//user/description'] 
    7272      end 
    7373 
     
    9292      def parse_profile(f) 
    9393        doc = REXML::Document.new(f) 
    94         @name = doc.elements['//feed/name'].text 
     94        @name = doc.elements['//feed/name'].text if doc.elements['//feed/name'] 
    9595        @image = "http://friendfeed-api.com/v2/picture/#{id}" 
    96         @description = doc.elements['//feed/description'].text 
     96        @description = doc.elements['//feed/description'].text if doc.elements['//feed/description'] 
    9797      end 
    9898