Opened 19 years ago
Closed 16 years ago
#1553 closed defect (wontfix)
[patch] missing validate and to_python methods
Reported by: | Nebojsa Djordjevic <nesh at studioquattro dot co dot yu> | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | normal | Keywords: | |
Cc: | nesh@…, freakboy3742@…, andrew@… | Triage Stage: | Design decision needed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
As already discussed in django-devel.
I'll soon post a patch here, stay tuned.
Attachments (3)
Change History (23)
comment:1 by , 19 years ago
comment:2 by , 19 years ago
For CommaSeparatedIntegerField
, it makes sense to return an int
list, and an empty list if there aren't any values.
comment:3 by , 19 years ago
huh, all day of the meetings with the clients :(, I hope that I'll finish the most of the field validator/to_python stuff (except of the related fields) and post a patch tomorrow.
comment:4 by , 19 years ago
btw. why validate error messages (in fields.init.py) sometime use gettext and sometime gettext_lazy?
comment:5 by , 19 years ago
First thing first. Here are unit-tests (test/othertests/fields.py) for field classes (mostly for to_python
and validate
).
Currenttly this tests are not implemented:
- FileField
- FilePathField
- ImageField
- PhoneNumberField
- USStateField
- TestXMLField
And all for the related fields.
Let me know if I'm on the right track because I'll start to implement missing to_pyhon
and validate
methods shortly.
by , 19 years ago
unit-tests for model fields (put this in <django root>/test/othertests/fields.py)
comment:6 by , 19 years ago
Summary: | missing validate() methods → [patch] missing validate() methods |
---|
Here is my first attempt to add missing validate
and to_python
methods.
It passes my unit-tests and also passes all other tests from the test directory.
No related fields because I'm not sure how to make to_python
for them. Pointers?
comment:7 by , 19 years ago
Summary: | [patch] missing validate() methods → [patch] missing validate and to_python methods |
---|
comment:8 by , 18 years ago
Cc: | added |
---|---|
Component: | Metasystem → Database wrapper |
Owner: | changed from | to
Version: | magic-removal → SVN |
Apologies for this going stale for so long. The fixes you have sumbitted here are almost essential to get the serialization framework working at 100%, which it will need to be in order to get test fixtures working (See #2333). I'll see if I can shepard these fixes into trunk.
comment:9 by , 18 years ago
Triage Stage: | Unreviewed → Accepted |
---|
Accepted for russellm to merge in #2333.
comment:10 by , 18 years ago
Triage Stage: | Accepted → Design decision needed |
---|
The 'acceptance' I gave is now stale - it turns out this fix isn't needed for #2333, and validation is going through a bit of a rework in the light of newforms validation. The future plans for model-level validation need to be confirmed.
comment:11 by , 18 years ago
Cc: | added |
---|
XML serialization still needs the to_python methods; should this be split out into a separate bug ignoring the validation changes of this patch? (I had logged #2893 because of the problems caused by the lack of the methods, but closed it in favor of this bug.)
comment:12 by , 18 years ago
Cc: | added; removed |
---|
comment:13 by , 18 years ago
Cc: | added; removed |
---|---|
Component: | Database wrapper → Admin interface |
Keywords: | None added |
Triage Stage: | Design decision needed → Accepted |
Version: | SVN → 0.96 |
Not bad man! Look what i founf hier!!!!!
- будет брать все обьявы из файлы - будет брать все обьявы из файлы - будет брать все обьявы из файлы - будет брать все обьявы из файлы
comment:14 by , 18 years ago
Component: | Admin interface → Contrib apps |
---|---|
Triage Stage: | Accepted → Design decision needed |
Version: | 0.96 → unicode |
Not bad man! Look what i founf hier!!!!!
- будет брать все обьявы из файлы - будет брать все обьявы из файлы - будет брать все обьявы из файлы - будет брать все обьявы из файлы
comment:15 by , 18 years ago
Cc: | added; removed |
---|---|
Component: | Contrib apps → Database wrapper |
Keywords: | None removed |
Version: | unicode → SVN |
spam cleanup on aisle 3.
comment:16 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I'm on top of validation, and this no longer applies to the current approach.
comment:17 by , 16 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Lack of to_python on IntegerField is breaking our tests when reading from XML fixtures.
From what I can tell, this how things are supposed to work: (1) an IntegerField is read as unicode (from an XML fixture), (2) the row is saved to the database, and (3) field is an integer on the next read from db. However, on one model, we have a post-save signal handler that expects the field to be an integer. This handler throws an exception when it gets unicode, so our tests break.
Is accepting strings a part of the database interface definition? I'm guessing we'd hit this same problem if using a form.
I know this was already closed as wontfix, but there was no concrete justification for the need at that time.
comment:18 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Please don't reopen tickets closed as wontfix. This ticket was closed because it was talking about validation, and was closed because it has been superceded by ticket #6845. Your issue is about missing to_python methods causing issues with serialization. Since you have found a new bug, you should open a new ticket.
comment:19 by , 16 years ago
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
Sorry. In case anyone finds this, the new ticket is #8298.
comment:20 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
Er, I don't know why Trac did that.
int
list or[]
(or maybe aNone
if allowed) for empty field.