Skip to content

Handle Django lazy strings.#47

Merged
medmunds merged 1 commit intomasterfrom
fix_lazy_strings
Dec 30, 2016
Merged

Handle Django lazy strings.#47
medmunds merged 1 commit intomasterfrom
fix_lazy_strings

Conversation

@medmunds
Copy link
Copy Markdown
Contributor

In BasePayload, ensure any Django ugettext_lazy
(or similar) are converted to real strings before
handing off to ESP code. This resolves problems where
calling code expects it can use lazy strings "anywhere",
but non-Django code (requests, ESP packages) don't
always handle them correctly.

  • Add utils helpers for lazy objects (is_lazy, force_non_lazy*)
  • Add lazy object handling to utils.Attachment
  • Add lazy object handling converters to BasePayload attr
    processing where appropriate. (This ends up varying by
    the expected attribute type.)

Fixes #34.

In BasePayload, ensure any Django ugettext_lazy
(or similar) are converted to real strings before
handing off to ESP code. This resolves problems where
calling code expects it can use lazy strings "anywhere",
but non-Django code (requests, ESP packages) don't
always handle them correctly.

* Add utils helpers for lazy objects (is_lazy, force_non_lazy*)
* Add lazy object handling to utils.Attachment
* Add lazy object handling converters to BasePayload attr
  processing where appropriate. (This ends up varying by
  the expected attribute type.)

Fixes #34.
@medmunds medmunds merged commit edf2a3d into master Dec 30, 2016
@medmunds medmunds deleted the fix_lazy_strings branch December 30, 2016 20:48
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

Successfully merging this pull request may close these issues.

UnicodeEncodeError: 'ascii' codec can't encode character [with ugettext_lazy]

1 participant