{{{
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.
* easy: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:1>
* 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>
--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:3>
* has_patch: 1 => 0
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/32709#comment:4>
* has_patch: 0 => 1
Old description:
> 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
> }}}
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:
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#comment:5>
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>
* 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>