Re: [Django] #27476: model Integer fields (and derivatives) do not raise a ValidationError while other types do

2016-11-16 Thread Django
#27476: model Integer fields (and derivatives) do not raise a ValidationError 
while
other types do
-+-
 Reporter:  Romeo Mihalcea   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  invalid
 Keywords:  models, integer, | Triage Stage:
  ValidationError|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

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


--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.67c9b24b13964f125910b9e07c11%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27476: model Integer fields (and derivatives) do not raise a ValidationError while other types do

2016-11-12 Thread Django
#27476: model Integer fields (and derivatives) do not raise a ValidationError 
while
other types do
-+-
 Reporter:  Romeo Mihalcea   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  models, integer, | Triage Stage:
  ValidationError|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham):

 I'm not certain whether or not this should be a bug. The inconsistency is
 unexpected I suppose, but from a public API standpoint, my understanding
 is that validation isn't expected on a model until calling
 `Model.full_clean()`, If you'd like to propose a patch, that might help
 evaluate the idea.

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.253af9f524ee5104c9254a5f04325fdb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27476: model Integer fields (and derivatives) do not raise a ValidationError while other types do

2016-11-11 Thread Django
#27476: model Integer fields (and derivatives) do not raise a ValidationError 
while
other types do
-+-
 Reporter:  Romeo Mihalcea   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  models, integer, | Triage Stage:
  ValidationError|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Romeo Mihalcea:

Old description:

> I have a model with `Decimal` fields, `Boolean` fields and some `Integer`
> fields. While testing with invalid data (I mostly supplied a string to
> these fields) I noticed that the integer fields do not raise a
> `ValidationError` while all of the other fields do so. Supplying a string
> to all Integer fields raise a `ValueError` instead which looks like all
> other fields have a basic validation in place while the Integers do not.
> I know I'm supposed to perform the validations before the data reaches
> the model but this is testing and I like to make sure everything is as
> intended.
>
> Example:
>

> {{{
> # model
> class Worker(models.Model):
> ...
> disabled = models.BooleanField(default=False)
> max_execution = models.PositiveSmallIntegerField(default=3600,
> null=False)
>

> # testcase
> class TestModelWorker(unittest.TestCase):
>
> def test_max_execution(self):
> # Here we expect a Python ValueError to be raised when providing
> a string
> # as an argument to what is a `PositiveSmallIntegerField`
> with self.assertRaises(ValueError) as e:
> Worker.create(
> name="Worker",
> max_execution='s'
> )
>
> self.assertIn('invalid literal for int() with base 10',
> str(e.exception))
>
> def test_disabled(self):
> # While here we can expect a `ValidationError` when providing a
> string to a `BooleanField`
> with self.assertRaises(ValidationError) as e:
> Worker.create(
> name="Worker",
> disabled='s'
> )
> }}}

New description:

 I have a model with `Decimal` fields, `Boolean` fields and some `Integer`
 fields. While testing with invalid data (I mostly supplied a string to
 these fields) I noticed that the integer fields do not raise a
 `ValidationError` while all of the other fields do so. Supplying a string
 to all Integer fields raise a `ValueError` instead which looks like all
 other fields have a basic validation in place while the Integers do not. I
 know I'm supposed to perform the validations before the data reaches the
 model but this is testing and I like to make sure everything is as
 intended.

 Example:


 {{{
 # model
 class Worker(models.Model):
 ...
 disabled = models.BooleanField(default=False)
 max_execution = models.PositiveSmallIntegerField(default=3600,
 null=False)


 # testcase
 class TestModelWorker(unittest.TestCase):

 def test_max_execution(self):
 # Here we expect a Python ValueError to be raised when providing a
 string
 # as an argument to what is a `PositiveSmallIntegerField`
 with self.assertRaises(ValueError) as e:
 Worker.create(
 name="Worker",
 max_execution='s'
 )

 self.assertIn('invalid literal for int() with base 10',
 str(e.exception))

 def test_disabled(self):
 # While here we can expect a `ValidationError` when providing a
 string to a `BooleanField`
 with self.assertRaises(ValidationError) as e:
 Worker.create(
 name="Worker",
 disabled='s'
 )
 self.assertIn('value must be either True or False',
 str(e.exception))
 }}}

--

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.f8c517885f7ecd961d0391e3b83f515e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27476: model Integer fields (and derivatives) do not raise a ValidationError while other types do

2016-11-11 Thread Django
#27476: model Integer fields (and derivatives) do not raise a ValidationError 
while
other types do
-+-
 Reporter:  Romeo Mihalcea   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  models, integer, | Triage Stage:
  ValidationError|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Romeo Mihalcea):

 Replying to [comment:2 Romeo Mihalcea]:
 Added some modifications

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.7c82865de62df7a9bff6b064e3759418%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27476: model Integer fields (and derivatives) do not raise a ValidationError while other types do

2016-11-11 Thread Django
#27476: model Integer fields (and derivatives) do not raise a ValidationError 
while
other types do
-+-
 Reporter:  Romeo Mihalcea   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  models, integer, | Triage Stage:
  ValidationError|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Description changed by Romeo Mihalcea:

Old description:

> I have a model with `Decimal` fields, `Boolean` fields and some `Integer`
> fields. While testing with invalid data (I mostly supplied a string to
> these fields) I noticed that the integer fields do not raise a
> `ValidationError` while all of the other fields do so. Supplying a string
> to all Integer fields raise a `ValueError` instead which looks like all
> other fields have a basic validation in place while the Integers do not.
> I know I'm supposed to perform the validations before the data reaches
> the model but this is testing and I like to make sure everything is as
> intended.

New description:

 I have a model with `Decimal` fields, `Boolean` fields and some `Integer`
 fields. While testing with invalid data (I mostly supplied a string to
 these fields) I noticed that the integer fields do not raise a
 `ValidationError` while all of the other fields do so. Supplying a string
 to all Integer fields raise a `ValueError` instead which looks like all
 other fields have a basic validation in place while the Integers do not. I
 know I'm supposed to perform the validations before the data reaches the
 model but this is testing and I like to make sure everything is as
 intended.

 Example:


 {{{
 # model
 class Worker(models.Model):
 ...
 disabled = models.BooleanField(default=False)
 max_execution = models.PositiveSmallIntegerField(default=3600,
 null=False)


 # testcase
 class TestModelWorker(unittest.TestCase):

 def test_max_execution(self):
 # Here we expect a Python ValueError to be raised when providing a
 string
 # as an argument to what is a `PositiveSmallIntegerField`
 with self.assertRaises(ValueError) as e:
 Worker.create(
 name="Worker",
 max_execution='s'
 )

 self.assertIn('invalid literal for int() with base 10',
 str(e.exception))

 def test_disabled(self):
 # While here we can expect a `ValidationError` when providing a
 string to a `BooleanField`
 with self.assertRaises(ValidationError) as e:
 Worker.create(
 name="Worker",
 disabled='s'
 )
 }}}

--

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.286e2160d58edc0d04a002016ce71cd3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27476: model Integer fields (and derivatives) do not raise a ValidationError while other types do

2016-11-11 Thread Django
#27476: model Integer fields (and derivatives) do not raise a ValidationError 
while
other types do
-+-
 Reporter:  Romeo Mihalcea   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  models, integer, | Triage Stage:
  ValidationError|  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham):

 Can you please provide some sample code that demonstrates the issue?

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.6a0a976ef204d2d541c77463e29f8706%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27476: model Integer fields (and derivatives) do not raise a ValidationError while other types do

2016-11-10 Thread Django
#27476: model Integer fields (and derivatives) do not raise a ValidationError 
while
other types do
-+-
   Reporter:  Romeo  |  Owner:  nobody
  Mihalcea   |
   Type:  Bug| Status:  new
  Component:  Database   |Version:  1.10
  layer (models, ORM)|   Keywords:  models, integer,
   Severity:  Normal |  ValidationError
   Triage Stage: |  Has patch:  0
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 I have a model with `Decimal` fields, `Boolean` fields and some `Integer`
 fields. While testing with invalid data (I mostly supplied a string to
 these fields) I noticed that the integer fields do not raise a
 `ValidationError` while all of the other fields do so. Supplying a string
 to all Integer fields raise a `ValueError` instead which looks like all
 other fields have a basic validation in place while the Integers do not. I
 know I'm supposed to perform the validations before the data reaches the
 model but this is testing and I like to make sure everything is as
 intended.

--
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.3afe93b7cc190b994e114251c44b130d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.