Opened 10 years ago

Closed 9 years ago

#4433 closed (invalid)

typo in django/db/models/fields/__init__.py

Reported by: Krzysztof Sitarski <sit0@…> Owned by: Adrian Holovaty
Component: Database layer (models, ORM) Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

in line 500 (DateTime.get_db_prep_save) there should be:

value = time.strptime(value, '%Y-%m-%d')

instead of:

value = value.strftime('%Y-%m-%d')

Attachments (1)

4433.patch (571 bytes) - added by Krzysztof Sitarski <sit0@…> 10 years ago.

Download all attachments as: .zip

Change History (7)

Changed 10 years ago by Krzysztof Sitarski <sit0@…>

Attachment: 4433.patch added

comment:1 Changed 10 years ago by Adrian Holovaty

Are you sure this is a typo? It's been working thus far...

Could you explain what the problem is?

comment:2 Changed 10 years ago by patrys@…

Exception Type:  	AttributeError
Exception Value: 	'str' object has no attribute 'strftime'

comment:3 Changed 10 years ago by patrys@…

BTW, I believe this was caused by using raw request.POST instead of Form.cleaned_data. This is not my code and I just fixed a similar "error" that was caused by using wrong data source

comment:4 Changed 10 years ago by Malcolm Tredinnick

We are still no closer to establishing if this is a problem in Django or not. What do you have to do to replicate this problem. Merely posting the exception does not give steps to reproducing.

As Adrian mentioned, there is already a lot of code using that code path, so it must be something unusual that is being done to trigger this. A small example that demonstrates the problem would be ideal here.

comment:5 Changed 10 years ago by patrys@…

Please notice that I am not the one who filed the bug. I just saw a production code hitting the same line that the patch changes and after going through the code I found out the reason was a call to a model constructor that used request.POST instead of form.cleaned_data

comment:6 Changed 9 years ago by Simon G. <dev@…>

Resolution: invalid
Status: newclosed

Marked as invalid unless someone can please give some more information?

Note: See TracTickets for help on using tickets.
Back to Top