User.get_preferences must return a copy

preferences is stored in the cache but as it is a mutable object, we must
return a copy to prevent cache corruption.

issue3442
review1351002
(transplanted from de55086332d1f9f65b920c50c3692a6ee93216ed)

--HG--
extra : transplant_source : %DEU%08c2%D1%F9%F6%5B%92%0CP%C3i%2An%E92%16%ED