#1213 closed defect (fixed)
Value of NOT_PROVIDED might collide with real data
| Reported by: | Antti Kaihola | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | |
| Severity: | trivial | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
In django.core.meta.fields, NOT_PROVIDED is defined as
# Random entropy string used by "default" param. NOT_PROVIDED = 'oijpwojefiojpanv'
Although extremely unlikely, this string could appear as a default value in a model and be interpreted as if no default value was provided.
Is there something preventing the following:
class NOT_PROVIDED:
pass
Or are there some control characters in the range chr(0..31) which don't make sense in the database backend side and could be used here?
Change History (2)
comment:1 by , 20 years ago
comment:2 by , 20 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Or what about this solution:
class NotProvided(str): pass NOT_PROVIDED = NotProvided('No default value is provided.') if some_default_value is NOT_PROVIDED: print 'There is no default value.' # and act accordingly