cameronmaske / celery-once

Celery Once allows you to prevent multiple execution and queuing of celery tasks.
https://pypi.python.org/pypi/celery_once/
BSD 2-Clause "Simplified" License
662 stars 90 forks source link

Unify the repr of both str and unicode strings #14

Closed brouberol closed 9 years ago

brouberol commented 9 years ago

If the task is called with a kwarg as a list of str, the serialization/deserialization step may (depending on the one used) convert it to a list unicode strings. The repr of the list would then differ (eg "['a', 'b']" vs "[u'a', u'b']"), leading to two different redis keys.

To solve this issue, we recursively parse every kwarg list, and encode any python 2 unicode string into a byte string (str) using the UTF-8 codec.

Note that nothing is done for python3, as it does not use the u prefix by default.

brouberol commented 9 years ago

This is my take at fixing #11

brouberol commented 9 years ago

I'm closing this PR, as it's a duplicate of https://github.com/TrackMaven/celery-once/pull/13