Re: [Django] #20251: UnicodeEncodeError with DecimalField

2013-04-15 Thread Django
#20251: UnicodeEncodeError with DecimalField
---+--
 Reporter:  anonymous  |Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Forms  |  Version:  1.5
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by bmispelon):

 * resolution:  needsinfo => invalid


Comment:

 OK, that explains it. It looks like you've stumbled into a bug of
 `cdecimal`.

 FYI, python 3.3 integrated cdecimal with some further performance
 improvements so if you have a chance, you should check it out.


 I'm marking this as `invalid` since the bug is not in django itself. If
 you disagree, feel free to re-open the ticket or start a thread on the
 django-dev mailing list.

 Thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20251: UnicodeEncodeError with DecimalField

2013-04-13 Thread Django
#20251: UnicodeEncodeError with DecimalField
---+--
 Reporter:  anonymous  |Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Forms  |  Version:  1.5
 Severity:  Normal |   Resolution:  needsinfo
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by anonymous):

 I use cdecimal for speedup operations, it problem

 {{{
 import cdecimal # speedup decimal
 sys.modules["decimal"] = cdecimal
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20251: UnicodeEncodeError with DecimalField

2013-04-12 Thread Django
#20251: UnicodeEncodeError with DecimalField
---+--
 Reporter:  anonymous  |Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Forms  |  Version:  1.5
 Severity:  Normal |   Resolution:  needsinfo
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by anonymous):

 * status:  new => closed
 * resolution:   => needsinfo


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20251: UnicodeEncodeError with DecimalField

2013-04-12 Thread Django
#20251: UnicodeEncodeError with DecimalField
---+--
 Reporter:  anonymous  |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Forms  |  Version:  1.5
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by anonymous):

 Looks like it's something with the my options in settings.py
 Clear django-project work's fine. I will test this in detail.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20251: UnicodeEncodeError with DecimalField

2013-04-12 Thread Django
#20251: UnicodeEncodeError with DecimalField
---+--
 Reporter:  anonymous  |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  Forms  |  Version:  1.5
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by bmispelon):

 * status:  closed => new
 * resolution:  invalid =>


Comment:

 Interesting.

 Does `Decimal(u"1 грн")` also trigger a `UnicodeEncodeError` in a plain
 python shell?

 I'm reopening because I don't have access to a windows installation to
 test this.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20251: UnicodeEncodeError with DecimalField

2013-04-12 Thread Django
#20251: UnicodeEncodeError with DecimalField
---+--
 Reporter:  anonymous  |Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Forms  |  Version:  1.5
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--

Comment (by anonymous):

 {{{
 #!/usr/bin/python
 # -*- coding: utf-8 -*-
 import sys
 import os

 os.environ['DJANGO_SETTINGS_MODULE'] = 'agu.settings'

 from agu import settings
 from django import forms

 class TestForm(forms.Form):
 field = forms.DecimalField()

 data = {'field': u"1 грн"}
 form = TestForm(data)
 if form.is_valid():
 print(form.cleaned_data)
 else:
 print('Invalid form')

 }}}

 Runing on Windows7 64bit, python 2.7, Django 1.5

 {{{
 Traceback (most recent call last):
   File "temp.py", line 19, in 
 if form.is_valid():
   File "C:\Python\lib\site-packages\django\forms\forms.py", line 126, in
 is_valid
 return self.is_bound and not bool(self.errors)
   File "C:\Python\lib\site-packages\django\forms\forms.py", line 117, in
 _get_errors
 self.full_clean()
   File "C:\Python\lib\site-packages\django\forms\forms.py", line 272, in
 full_clean
 self._clean_fields()
   File "C:\Python\lib\site-packages\django\forms\forms.py", line 287, in
 _clean_fields
 value = field.clean(value)
   File "C:\Python\lib\site-packages\django\forms\fields.py", line 154, in
 clean
 value = self.to_python(value)
   File "C:\Python\lib\site-packages\django\forms\fields.py", line 293, in
 to_python
 value = Decimal(value)
 UnicodeEncodeError: 'decimal' codec can't encode characters in position
 2-4: invalid decimal Unicode string
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: [Django] #20251: UnicodeEncodeError with DecimalField

2013-04-12 Thread Django
#20251: UnicodeEncodeError with DecimalField
---+--
 Reporter:  anonymous  |Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  Forms  |  Version:  1.5
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+--
Changes (by bmispelon):

 * status:  new => closed
 * cc: bmispelon@… (added)
 * needs_better_patch:   => 0
 * needs_tests:   => 0
 * needs_docs:   => 0
 * resolution:   => invalid


Comment:

 Hi,

 Could you provide more details on how to reproduce the issue?

 I tried the following (with python 2.7 and 3.2) but could not trigger the
 `UnicodeEncodeError`:
 {{{
 #!python
 class TestForm(forms.Form):
 field = forms.DecimalField()

 data = {'field': u"1 грн"}
 form = TestForm(data)
 if form.is_valid():
 print(form.cleaned_data)
 else:
 print('Invalid form')
 }}}

 This prints out "Invalid form", without triggering any other error.

 I also simply tried `Decimal("1 грн")` but this raise a
 `DecimalException`, not a `UnicodeEncodeError`.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[Django] #20251: UnicodeEncodeError with DecimalField

2013-04-12 Thread Django
#20251: UnicodeEncodeError with DecimalField
+
 Reporter:  anonymous   |  Owner:  nobody
 Type:  Bug | Status:  new
Component:  Forms   |Version:  1.5
 Severity:  Normal  |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0   |  UI/UX:  0
+
 My form:
 {{{
 class TestForm(forms.Form):
 value = forms.DecimalField()

 }}}
 When enteing "1 грн"


 {{{
 'decimal' codec can't encode characters in position 4-6: invalid decimal
 Unicode string
 }}}


 Method '''to_python''' catch only 'DecimalException' but not
 'UnicodeEncodeError'.
 {{{


 C:\Python\lib\site-packages\django\forms\fields.py in to_python
 """
 if value in validators.EMPTY_VALUES:
 return None
 if self.localize:
 value = formats.sanitize_separators(value)
 value = smart_text(value).strip()
 try:
 value = Decimal(value)
 ...
 except DecimalException:
 raise ValidationError(self.error_messages['invalid'])

 return value

 def validate(self, value):

 super(DecimalField, self).validate(value)


 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.