[ckan-dev] Translators and threads

Adrià Mercader amercadero at gmail.com
Tue Apr 19 09:24:18 UTC 2011


Hi all,

I have a question related with translators and threads, and I was
hoping somebody could give me a clue.

I'm using the new logic functions in ckan core to create/edit packages
from the import stage of the harvesting process, which runs on a
queue. When the logic functions found an error, they use the
underscore function to i18nize the message:
_('Package not found') or whatever

The problem is that then I get an error like this one:

TypeError: No object (name: translator) has been registered for this thread

(Full traceback at the end of the email)

I guess it's related with the code running on a different thread. Does
anyone know how "to register the translator for this thread"?

Thanks,

Adrià

Traceback (most recent call last):
  File "/home/adria/dev/envs/ckan/bin/paster", line 8, in <module>
    load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/paste/script/command.py",
line 84, in run
    invoke(command, command_name, options, args[1:])
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/paste/script/command.py",
line 123, in invoke
    exit_code = runner.run(args)
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/paste/script/command.py",
line 218, in run
    result = self.command()
  File "/home/adria/dev/envs/ckan/src/ckanext-harvest/ckanext/harvest/commands/harvester.py",
line 86, in command
    consumer.wait()
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/carrot/messaging.py",
line 446, in wait
    it.next()
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/carrot/backends/pyamqplib.py",
line 300, in consume
    self.channel.wait()
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/amqplib/client_0_8/abstract_channel.py",
line 107, in wait
    return amqp_method(self, args, content)
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/amqplib/client_0_8/channel.py",
line 1973, in _basic_deliver
    func(msg)
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/carrot/messaging.py",
line 291, in _receive_callback
    self.receive(message.payload, message)
  File "/home/adria/dev/envs/ckan/lib/python2.6/site-packages/carrot/messaging.py",
line 344, in receive
    callback(message_data, message)
  File "/home/adria/dev/envs/ckan/src/ckanext-harvest/ckanext/harvest/queue.py",
line 136, in fetch_callback
    harvester.import_stage(obj)
  File "/home/adria/dev/envs/ckan/src/ckanext-harvest/ckanext/harvest/harvesters.py",
line 163, in import_stage
    raise e
TypeError: No object (name: translator) has been registered for this thread




More information about the ckan-dev mailing list