Hi,

  here again...

  I think that this is an error, at least again a different behaviour
  compared to version of some weeks ago (r4871)


## english version gives no problem
(Pdb) print "New Ticket #%(id)s '%(title)s' for project %(project)s" %
(Item(instance))
New Ticket #3 'test 3' for project jungle

## translated version raise TypeError
(Pdb) _("New Ticket #%(id)s '%(title)s' for project %(project)s")
*** TypeError: 'Item' object is not callable


## let's take the gettext, not the builtin one
(Pdb) from django.utils.translation import gettext
(Pdb) gettext("New Ticket #%(id)s '%(title)s' for project %
(project)s")
"Nuovo Ticket #%(id)s '%(title)s' per il progetto %(project)s"

it works!

just for completeness Item is defined as:

class Item(object):
    """ a simple way to turn an instance into a subscriptable obj
    return an object encoded into settings.DEFAULT_CARSET
    """

    def __init__(self, obj, enc=settings.DEFAULT_CHARSET):
        self.obj = obj
        self.ENC = enc

    def __getitem__(self, name):
        try:
            return getattr(self.obj, name).encode(self.ENC)
        except:
            ## integers and other do not have 'encode' attribute
            return getattr(self.obj, name)

Of course the solution for me is just to import gettext explicitely.
Should
I file a ticket for this?

sandro
*:-)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to