Project

General

Profile

« Previous | Next » 

Revision a5e14040

Added by Marc Dequènes over 11 years ago

[workaround] fast_gettext (needed by active_ldap) does not handle po files encoding properly

View differences:

lib/cyborghood/objects/ldap.rb
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#++
# workaround for https://github.com/grosser/fast_gettext/issues/32
# (active_ldap needs it, as it fails to use GetText)
old_enc = Encoding.default_external
Encoding.default_external = 'binary'
require 'active_ldap'
module CyborgHood
class LdapDnsDomain < ActiveLdap::Base
ldap_mapping :dn_attribute => 'cn', :prefix => '', :classes => ['genericDomain']
......
ldap_mapping :dn_attribute => 'uid', :prefix => '', :classes => ['individual']
end
end
# end of workaround
# (fast_gettext is reloaded each time ActiveLdap::Base is subclassed, thus wrapping 'require'
# is not sufficient, and we need to restore proper defaults only after all LDAP class are
# created :-/)
Encoding.default_external = old_enc

Also available in: Unified diff