curry can't be replaced by functools.partial
|Reported by:||bear330||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I think this should not be a bug.
I do this before:
# We make sure we are using Python 2.5, so partial is faster than # django's curry function. import functools from django.utils import functional functional.curry = functools.partial
This works fine at 1.0.2 and previous versions.
After I upgrade to 1.0.4, I got many problems while rendering template. I do some investigation, the problem is because
def _render_value_in_context(value, context): """ Converts any value to a string to become part of a rendered template. This means escaping, if required, and conversion to a unicode object. If value is a string, it is expected to have already been translated. """ value = force_unicode(value) if (context.autoescape and not isinstance(value, SafeData)) or isinstance(value, EscapeData): return escape(value) else: return value
While rendering node, force_unicode a SafeString will raise error.
I am just curious, why can't I replace curry with functools.partial?