Code

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#316 closed defect (fixed)

Error while logging into Admin site since revision 487

Reported by: berry.groenendijk@… Owned by: adrian
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: UI/UX:

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.

Attachments (0)

Change History (8)

comment:1 Changed 9 years ago by berry.groenendijk@…

  • Summary changed from Error while logging into Admin site to Error 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 Changed 9 years ago by adrian

  • Status changed from new to assigned

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

comment:3 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:4 Changed 9 years ago by adrian

  • Resolution fixed deleted
  • Status changed from closed to reopened

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

comment:5 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:6 Changed 9 years ago by berry.groenendijk@…

  • Resolution fixed deleted
  • Severity changed from critical to major
  • Status changed from closed to reopened

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 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from reopened to closed

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

comment:8 Changed 8 years ago by mtredinnick

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.