X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Frm%2Fplugins%2Fagendav.rb;h=6d92c26d6fb054d9de44ba5d30b60abec76c2f8d;hp=0f4e790f6f4007f124eed570db7d52651f767d8a;hb=a731b98f97194b8882c42d3c2b27de75f60d6b05;hpb=72696d3f6e95ef773af9727e9c3459b9038b0fc2 diff --git a/lib/rm/plugins/agendav.rb b/lib/rm/plugins/agendav.rb index 0f4e790..6d92c26 100644 --- a/lib/rm/plugins/agendav.rb +++ b/lib/rm/plugins/agendav.rb @@ -12,31 +12,19 @@ class AgendavRm def delete_user(user) # Delete the given username and any records in other tables # belonging to it. - raise NonexistentUserError.new(user) if not user_exists(user) + raise NonexistentUserError.new(user.to_s()) if not user_exists(user) sql_queries = ['DELETE FROM prefs WHERE username = $1;'] sql_queries << 'DELETE FROM shared WHERE user_from = $1;' - begin - connection = PGconn.connect(@db_host, - @db_port, - @db_opts, - @db_tty, - @db_name, - @db_user, - @db_pass) + connection = PGconn.connect(@db_host, @db_port, @db_opts, @db_tty, + @db_name, @db_user, @db_pass) - sql_queries.each do |sql_query| - connection.query(sql_query, [user]) - end - - connection.close() - - rescue PGError => e - # Pretend like we're database-agnostic in case we ever are. - raise DatabaseError.new(e) + sql_queries.each do |sql_query| + connection.query(sql_query, [user.to_s()]) end + connection.close() end end