#11474 closed (duplicate)
models.XMLField doesn't work as advertised
Reported by: | Jim Garrison | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | UI/UX: |
Description
There are two errors currently in the (documentation of) models.XMLField
:
- The documentation claims that
schema_path
is a required argument, but it is not. - Regardless of whether
schema_path
is given,models.XMLField
does not actually perform any validation. It works no differently than an ordinaryTextField
, succeeding even if the input is not XML at all.
Tickets #3094 and #5620 are likely related to this bug. I reference them for historical interest, since it seems that it was once assumed that #3094 would to be fixed before 1.0.
Change History (5)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 15 years ago
comment:3 by , 14 years ago
Component: | Database layer (models, ORM) → Documentation |
---|---|
milestone: | → 1.3 |
This is really a docs ticket. I'm changing the category to reflect that, so that it'll get some attention.
#3094 will be resolved whenever it gets resolved (if ever) but in the meantime the docs should reflect the way Django really functions (especially for 1.1 and 1.2 where the feature will never surface).
I suggest changing the relevant docs to read something like:
A TextField for XML. Does not currently provide any validation. Takes one optional argument: schema_path The filesystem path to an XML schema.
In addition to posting here, I'll try and get that ticket moving as well.
comment:4 by , 14 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Closing as a duplicate of #3094. There's no point in changing the docs until that ticket is resolved. My thoughts on what the resolution should be are noted on that ticket.
As a stopgap measure, xml.parsers.expat could be used to verify that the XML is at least well-formed, albeit perhaps not compliant with any particular schema.
For example, I currently use the following on a form that allows users to input XML in a multi-line text field:
This could/should perhaps be instead implemented in django.db.models.fields instead.