Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: translation table must be 256 characters long #5

Closed
rors opened this issue Mar 14, 2012 · 3 comments
Closed

ValueError: translation table must be 256 characters long #5

rors opened this issue Mar 14, 2012 · 3 comments

Comments

@rors
Copy link

rors commented Mar 14, 2012

Using version 1.2.4, I get the following error when trying to use a ManyToManyField:

Exception Type: ValueError
Exception Value:    translation table must be 256 characters long
Exception Location: /opt/Projects/datamining/eggs/django_ajax_selects-1.2.4-py2.6.egg/ajax_select/fields.py in __init__, line 210

That seems to be a problem with the line that reads:

en_help = help_text.translate('en')

which doesn't seem to be valid Python: http://docs.python.org/library/string.html#string.translate

I would submit a patch but I'm not sure exactly what was even intended here.

thanks.

@taivo
Copy link

taivo commented Jun 2, 2012

Hi, I'm not sure what the final decision was for this issue given the related discussion at https://github.com/brianmay/django-ajax-selects/issues/1

I've just encountered this error and it looks like the quick (though perhaps not best) work around for this error is to set your help_text to unicode, i.e., u"my help text". That hint was buried in the discussion cited above.

Hope this comment help save other people time.

@mcalvo
Copy link

mcalvo commented Aug 14, 2012

The brianmay fix works. It's a one line change, but it fixes the weird translation error.

@crucialfelix
Copy link
Owner

actually that particular error was much simpler: you supplied '' instead of u''
in the new release I have added a check for that common case, and the code for the monkey patching has changed so it doesn't try to translate your input anyway.
should be solved now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants