-
Notifications
You must be signed in to change notification settings - Fork 126
Add bytes_strictness to allow configuring behavior on bytes/text mismatch #171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
5ce6e74
to
1b17e85
Compare
Codecov Report
@@ Coverage Diff @@
## master #171 +/- ##
=========================================
- Coverage 69.61% 69.51% -0.1%
=========================================
Files 49 49
Lines 4732 4740 +8
Branches 817 820 +3
=========================================
+ Hits 3294 3295 +1
- Misses 1084 1088 +4
- Partials 354 357 +3
Continue to review full report at Codecov.
|
@tiran, whenever you're ready, could you take a look? |
@encukou Next week after DevConf CZ. |
if bytes_mode: | ||
raise ValueError("bytes_mode is *not* supported under Python 3.") | ||
bytes_mode = False | ||
bytes_strictness = 'error' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe raise an exception when bytes_strictness
argument is neither 'error'
nor None
?
is a subclass of :class:`BytesWarning` designed to be easily | ||
:ref:`filtered out <filter-bytes-warning>` if needed. | ||
``bytes_strictness='error'`` (default if ``bytes_mode`` is specified): | ||
A ``TypeError`` is raised. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should spell out the behavior in form of an example and list affected attributes
If bytes_mode is True and a text string is encountered, then a TypeError is raised. If bytes_mode is False...
Bytes mode applies to:
dn
argumentattr
argumentnewrdn
argument forrename
who
andcred
forbind
user
,oldpw
andnewpw
forpasswd
base
,filterstr
andattrlist
members forsearch*
mod_type
(2nd argument) of modlist member foradd*
,modify*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I linked to text mode from those arguments. Does that look good?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks mostly fine. See inline comments for nit-picks and improved documentation.
Should document that the strictness option only applies to py2; on py3 it's ignored. It's done this way for py2/py3 single-source compatibility. |
Thi is done to better support programs compatible with both py2 and py3.
@tiran, do you think you'll find some time to review? |
@tiran, can you get to a review by end of this week? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ship it!
We can address https://github.com/python-ldap/python-ldap/pull/171/files#r164738710 another time
See #166 for initial discussion, or the changed docs for what is added.
I've used
bytes_strictness
instead ofbytes_warnings
, since warnings is just one of the possible behaviors. The new name isn't perfect either, though.