Yeah, I'll do it tomorrow ...

Dražen

On 30/07/18 15:19, Tim Graham wrote:
> It doesn't look like that force_text() was added specifically to handle lazy
> strings (see django/template/__init__.py in
> https://github.com/django/django/commit/953badbea5a04159adbfa970f5805c0232b6a401)
>  but
> Django does have str() calls in various places to handle lazy strings, e.g.
> https://github.com/django/django/blob/cebbcaa1baa6eb7f9ec3e223abdc496a983ea482/django/urls/resolvers.py#L486.
> I think it would be fine to restore the old behavior. Can you create a ticket
> and offer a patch before the final bug fix release for Django 2.0.x on 
> Wednesday?
> 
> On Monday, July 30, 2018 at 4:59:51 AM UTC-4, Dražen Odobašić wrote:
> 
>     Hi,
> 
>     we are using Template engine to convert some translatable textual class 
> level
>     attributes, like [0]. In the process of migration to Django2.0, we got a
>     problem
>     with template Lexer which raises a `TypeError: expected string or 
> bytes-like
>     object` [1]
> 
>     I'm not sure if are just misusing the template system to do something 
> what it
>     wasn't designed for, or if this is a regression from Django 1.11. 
> Previously
>     Django was using `force_text` to force evaluation of a lazy string [2] and
>     Lexer
>     always got a text object.
> 
>     We could force the evaluation of the lazy strings in the application, but 
> I was
>     wandering if this is a regression, and should actually be fixed in Django?
> 
>     Dražen
> 
> 
>     [0]
>     
> https://github.com/rapidpro/rapidpro/blob/master/temba/channels/types/telegram/type.py#L27
>     
> <https://github.com/rapidpro/rapidpro/blob/master/temba/channels/types/telegram/type.py#L27>
> 
>     [1] 
> https://github.com/django/django/blob/2.0.7/django/template/base.py#L349
>     <https://github.com/django/django/blob/2.0.7/django/template/base.py#L349>
>     [2]
>     
> https://github.com/django/django/commit/3a148f958dddd97c1379081118c30fbede6b6bc4#diff-8cbe1fb6d589cb6e35b956704d7a1285L154
>     
> <https://github.com/django/django/commit/3a148f958dddd97c1379081118c30fbede6b6bc4#diff-8cbe1fb6d589cb6e35b956704d7a1285L154>
> 
> 
> -- 

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c58bd0d3-d3a0-9ace-4e87-82a8051d5a35%40candela-it.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to