Package pyamf :: Package adapters :: Module _django_utils_translation

[hide private]
[frames] | no frames]

# Source Code for Module pyamf.adapters._django_utils_translation

     1  # Copyright (c) 2007-2009 The PyAMF Project.
     2  # See LICENSE.txt for details.
     3
     4  """
     5  C{django.utils.translation} adapter module.
     6
     7  @see: U{Django Project<http://www.djangoproject.com>}
     8  @since: 0.4.2
     9  """
    10
    11  from django.utils.translation import ugettext_lazy
    12
    13  import pyamf
    14
    15
    16 -def convert_lazy(l, encoder=None):
    17      if l.__class__._delegate_unicode:
    18          return unicode(l)
    19
    20      if l.__class__._delegate_str:
    21          return str(l)
    22
    23      raise ValueError('Don\'t know how to convert lazy value %s' % (repr(l),))
    24
    25
    26  pyamf.add_type(type(ugettext_lazy('foo')), convert_lazy)
    27