[Django] #32709: fix utils/baseconv.py -> self.sign

33 views
Skip to first unread message

Django

unread,
May 3, 2021, 12:03:16 PM5/3/21
to django-...@googlegroups.com
#32709: fix utils/baseconv.py -> self.sign
-------------------------------------------+------------------------
Reporter: pythonwood | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: 3.2
Severity: Normal | Keywords: utils
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------------+------------------------
I have a simple pull in gihub # 14339
[https://github.com/django/django/pull/14339/commits/86e0ec9df0b5ed7a9160c10974bf1adef19eb539]


{{{
def encode(self, i):
neg, value = self.convert(i, self.decimal_digits, self.digits, '-')
}}}


try and know that arg '-' should be self.sign:


{{{
In [1]: from django.utils import baseconv

In [2]: base11 = baseconv.BaseConverter('0123456789-', sign='$')

In [3]: base11.encode('$1234')

ValueError: substring not found
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32709>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 3, 2021, 12:11:03 PM5/3/21
to django-...@googlegroups.com
#32709: fix utils/baseconv.py -> self.sign
---------------------------------+--------------------------------------

Reporter: pythonwood | Owner: (none)
Type: Bug | Status: new
Component: Error reporting | Version: 3.2
Severity: Normal | Resolution:

Keywords: utils | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by pythonwood):

* easy: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:1>

Django

unread,
May 3, 2021, 2:33:11 PM5/3/21
to django-...@googlegroups.com
#32709: django.utils.BaseConverter doesn't respect the "sign" argument.
----------------------------+--------------------------------------
Reporter: pythonwood | Owner: pythonwood
Type: Bug | Status: assigned
Component: Utilities | Version: 3.2
Severity: Normal | Resolution:
Keywords: utils | Triage Stage: Accepted

Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => assigned
* component: Error reporting => Utilities
* needs_tests: 0 => 1
* owner: (none) => pythonwood
* stage: Unreviewed => Accepted


Comment:

Thanks for the report. I also agree with Simon that we should deprecate
the `django.utils.baseconv` module, but this can be done separately.

--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:2>

Django

unread,
May 3, 2021, 2:33:40 PM5/3/21
to django-...@googlegroups.com
#32709: django.utils.baseconv.BaseConverter doesn't respect the "sign" argument.

----------------------------+--------------------------------------
Reporter: pythonwood | Owner: pythonwood
Type: Bug | Status: assigned
Component: Utilities | Version: 3.2
Severity: Normal | Resolution:
Keywords: utils | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------+--------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:3>

Django

unread,
May 4, 2021, 12:17:37 AM5/4/21
to django-...@googlegroups.com
#32709: Examples in django.utils.baseconv.BaseConverter's docstring are incorrect.

----------------------------+--------------------------------------
Reporter: pythonwood | Owner: pythonwood
Type: Bug | Status: assigned
Component: Utilities | Version: 3.2
Severity: Normal | Resolution:
Keywords: utils | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 1 => 0
* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:4>

Django

unread,
May 4, 2021, 12:40:14 AM5/4/21
to django-...@googlegroups.com
#32709: Examples in django.utils.baseconv.BaseConverter's docstring are incorrect.
----------------------------+--------------------------------------
Reporter: pythonwood | Owner: pythonwood
Type: Bug | Status: assigned
Component: Utilities | Version: 3.2
Severity: Normal | Resolution:
Keywords: utils | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by pythonwood):

* has_patch: 0 => 1


Old description:

> {{{
> def encode(self, i):
> neg, value = self.convert(i, self.decimal_digits, self.digits, '-')
> }}}
>

> try and know that arg '-' should be self.sign:
>

> {{{
> In [1]: from django.utils import baseconv
>
> In [2]: base11 = baseconv.BaseConverter('0123456789-', sign='$')
>
> In [3]: base11.encode('$1234')
>
> ValueError: substring not found
> }}}

New description:

----
NOW:
In fact, I found the right way is patch doc string instead of code.

I have a simple right (new) pull in gihub 14344
[https://github.com/django/django/pull/14344]


----
BEFORE:


{{{
def encode(self, i):
neg, value = self.convert(i, self.decimal_digits, self.digits, '-')
}}}


try and know that arg '-' should be self.sign:


{{{
In [1]: from django.utils import baseconv

In [2]: base11 = baseconv.BaseConverter('0123456789-', sign='$')

In [3]: base11.encode('$1234')

ValueError: substring not found
}}}

--

--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:5>

Django

unread,
May 4, 2021, 12:41:19 AM5/4/21
to django-...@googlegroups.com
#32709: Examples in django.utils.baseconv.BaseConverter's docstring are incorrect.
----------------------------+--------------------------------------
Reporter: pythonwood | Owner: pythonwood
Type: Bug | Status: assigned
Component: Utilities | Version: 3.2
Severity: Normal | Resolution:
Keywords: utils | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------+--------------------------------------

Comment (by pythonwood):

in fact, after look into regression test
tests/utils_tests/test_baseconv.py, I fount that It is wrong doc string
instead of code.

--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:6>

Django

unread,
May 4, 2021, 1:09:31 AM5/4/21
to django-...@googlegroups.com
#32709: Examples in django.utils.baseconv.BaseConverter's docstring are incorrect.
----------------------------+--------------------------------------
Reporter: pythonwood | Owner: pythonwood
Type: Bug | Status: closed
Component: Utilities | Version: 3.2
Severity: Normal | Resolution: fixed

Keywords: utils | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------+--------------------------------------
Changes (by GitHub <noreply@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"071cf6863005fd63ac2aefc509f90a18c6f4ec79" 071cf686]:
{{{
#!CommitTicketReference repository=""
revision="071cf6863005fd63ac2aefc509f90a18c6f4ec79"
Fixed #32709 -- Corrected examples in django/utils/baseconv.py docstring.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:7>

Reply all
Reply to author
Forward
0 new messages