Skip to content

Commit

Permalink
[api] parse <realname/> as '' not as nil (using xmlhash)
Browse files Browse the repository at this point in the history
  • Loading branch information
coolo committed Sep 3, 2012
1 parent 157d41c commit 6723ced
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/api/app/controllers/person_controller.rb
@@ -1,4 +1,4 @@
#require "rexml/document"
require 'xmlhash'

class PersonController < ApplicationController

Expand Down Expand Up @@ -78,10 +78,10 @@ def userinfo
end
end

xml = REXML::Document.new(request.raw_post)
xml = Xmlhash.parse(request.raw_post)
logger.debug("XML: #{request.raw_post}")
user.email = xml.elements["/person/email"].text
user.realname = xml.elements["/person/realname"].text
user.email = xml.value('email') || ''
user.realname = xml.value('realname') || ''
update_watchlist(user, xml)
user.save!
render_ok
Expand Down Expand Up @@ -200,8 +200,8 @@ def update_watchlist( user, xml )
new_watchlist = []
old_watchlist = []

xml.elements.each("/person/watchlist/project") do |e|
new_watchlist << e.attributes['name']
xml.get('watchlist').elements("project") do |e|
new_watchlist << e['name']
end

user.watched_projects.each do |wp|
Expand Down

0 comments on commit 6723ced

Please sign in to comment.