[Checkins] [zopefoundation/zope.schema] 9631fa: Add IFromBytes

GitHub noreply at github.com
Tue Sep 18 18:30:34 CEST 2018


  Branch: refs/heads/feature/IFromBytes
  Home:   https://github.com/zopefoundation/zope.schema
  Commit: 9631faaf42465d7bb4a7e89a6ffee4f7dd9c98af
      https://github.com/zopefoundation/zope.schema/commit/9631faaf42465d7bb4a7e89a6ffee4f7dd9c98af
  Author: Jason Madden <jamadden at gmail.com>
  Date:   2018-09-18 (Tue, 18 Sep 2018)

  Changed paths:
    M CHANGES.rst
    M src/zope/schema/_bootstrapfields.py
    M src/zope/schema/_bootstrapinterfaces.py
    M src/zope/schema/_compat.py
    M src/zope/schema/_field.py
    M src/zope/schema/interfaces.py
    M src/zope/schema/tests/test__bootstrapfields.py
    M src/zope/schema/tests/test__field.py

  Log Message:
  -----------
  Add IFromBytes

As a counterpoint to IFromUnicode.

This is useful when you know the type of data you're dealing with, and conversions are either trivially non-lossy (or will fail anyway) or are not necessary.

The numeric fields as well as Bytes/Line and URI, DottedName and Id implement this, the last three because they are native string lines that want to accept bytes on Python 2 anyway.

On Python 2, lxml likes to produce byte strings "to save memory" even when parsing unicode and given proper XML encoding information, so this can be very helpful there.



      **NOTE:** This service has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      Functionality will be removed from GitHub.com on January 31st, 2019.


More information about the checkins mailing list