Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#316 closed defect (fixed)

Error while logging into Admin site since revision 487

Reported by: berry.groenendijk@… Owned by: Adrian Holovaty
Component: contrib.admin Version:
Severity: major Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have been using Django for more than a week now. I love it! And I am using the Admin site in the same way every day, by using:

django-admin.py runserver --settings=MyDjango.settings.admin

Yet, yesterday I got this error:


There's been an error:

Traceback (most recent call last):

File "/usr/lib64/python2.3/site-packages/django/core/handlers/base.py", line 59, in get_response

response = middleware_method(request, callback, param_dict)

File "/usr/lib64/python2.3/site-packages/django/middleware/admin.py", line 77, in process_view

sessions.start_web_session(user.id, request, response)

File "/usr/lib64/python2.3/site-packages/django/models/auth.py", line 227, in _module_start_web_session

user.save()

File "/usr/lib64/python2.3/site-packages/django/utils/functional.py", line 3, in _curried

return args[0](*(args[1:]+moreargs), dict(kwargs.items() + morekwargs.items()))

File "/usr/lib64/python2.3/site-packages/django/core/meta/init.py", line 735, in method_save

db_values + [getattr(self, opts.pk.name)])

File "/usr/lib64/python2.3/site-packages/django/core/db/base.py", line 10, in execute

result = self.cursor.execute(sql, params)

File "/usr/lib64/python2.3/site-packages/MySQLdb/cursors.py", line 95, in execute

return self._execute(query, args)

File "/usr/lib64/python2.3/site-packages/MySQLdb/cursors.py", line 114, in _execute

self.errorhandler(self, exc, value)

File "/usr/lib64/python2.3/site-packages/MySQLdb/connections.py", line 33, in defaulterrorhandler

raise errorclass, errorvalue

Warning: Rows matched: 1 Changed: 1 Warnings: 1


Do you have any clue how I can solve this issue?

Thanks.

Change History (8)

comment:1 by berry.groenendijk@…, 19 years ago

Summary: Error while logging into Admin siteError while logging into Admin site since revision 487

I try to keep up with the latest revisions. So, I tested former revisions to see if the Admin site works in former revisions. And it does!

Up till revision 484 the Admin site works perfectly. But, the problem starts at revision 487! Then I get the errors as reported earlier. I am using a MySQL (version 3.23.58) backend. Apparently something was introduced in revision 487 that causes the Admin site to break!

comment:2 by Adrian Holovaty, 19 years ago

Status: newassigned

It's a stupid MySQL problem...I'm looking into it now. Thanks for the heads up!

comment:3 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: assignedclosed

(In [494]) Fixed #316 -- Changed MySQL backend to disregard warnings

comment:4 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: closedreopened

Reopened. The fix from [494] caused other problems.

comment:5 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: reopenedclosed

(In [497]) Fixed #316 -- Added special-case for MySQL microseconds, so that it doesn't throw a warning when microseconds are given.

comment:6 by berry.groenendijk@…, 19 years ago

Resolution: fixed
Severity: criticalmajor
Status: closedreopened

Adrian,

Sorry, I got an error on your modification.


There's been an error:

Traceback (most recent call last):

File "/usr/lib64/python2.3/site-packages/django/core/handlers/base.py", line 62, in get_response

return callback(request, param_dict)

File "/usr/lib64/python2.3/site-packages/MyDjango/apps/articleStore/views/articleStore.py", line 80, in update

fileModified=os.stat(os.path.join(store.articleFolder, fname)).st_mtime

File "/usr/lib64/python2.3/site-packages/django/utils/functional.py", line 3, in _curried

return args[0](*(args[1:]+moreargs), dict(kwargs.items() + morekwargs.items()))

File "/usr/lib64/python2.3/site-packages/django/core/meta/init.py", line 897, in method_add_related

obj.save()

File "/usr/lib64/python2.3/site-packages/django/utils/functional.py", line 3, in _curried

return args[0](*(args[1:]+moreargs), dict(kwargs.items() + morekwargs.items()))

File "/usr/lib64/python2.3/site-packages/django/core/meta/init.py", line 748, in method_save

db_values = [f.get_db_prep_save(f.pre_save(getattr(self, f.name), True)) for f in opts.fields if not isinstance(f, AutoField)]

File "/usr/lib64/python2.3/site-packages/django/core/meta/fields.py", line 305, in get_db_prep_save

value = value.replace(microsecond=0)

TypeError: 'microsecond' is an invalid keyword argument for this function


The reason why this error appears is that I am not passing a datetime object, but a date object. Before your change this worked perfectly. But, a date object has no parameter microsecond. A datetime object does. Is the code only meant to support the datetime object? Or should it also support date and time objects? If so, then the code needs some modification.

Thanks,
Berry

comment:7 by Adrian Holovaty, 19 years ago

Resolution: fixed
Status: reopenedclosed

I believe this is fixed now. If it's still a problem, please reopen with full details.

comment:8 by Malcolm Tredinnick, 18 years ago

(In [3183]) Fixed #2031 -- Don't try to remove microseconds on date objects (only datetime)
for MySQL. Refs #316.

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