This was working fine for my Ubuntu 10.04LTE system with Django
1.3.1. It seems broken now in 1.4.
In Django 1.4, I get this error TypeError: get_db_prep_value() got an
unexpected keyword argument 'connection' when saving an image to an
ImageField.
What you've hit here is the end of the deprecation cycle for code that doesn't support multiple databases.
In Django 1.2, we introduced multiple database support; in order to support this, the prototype for get_db_preb_lookup() and get_db_prep_value() was changed.
For backwards compatibility, we added a shim that would transparently 'fix' these methods if they hadn't already been fixed by the developer.
In Django 1.2, the usage of these shims raised a PendingDeprecationWarning. In Django 1.3, they raised a DeprecationWarning.
Under Django 1.4, the shim code was been removed -- so any code that wasn't updated will now raise errors like the one you describe.
All the core Django fields should have been updated to use the new signature, so if you're seeing errors, it's probably because of a custom field that you're using that needs to be updated. As far as I can make out, Django's default ImageField shouldn't have this problem (it doesn't even have db_prep_* methods, because there's nothing database specific about the storage of FileFields).
If you can reproduce this on a project that only uses Django's built-in field types, then this is a bug in Django that needs to be addressed.
Yours
Russ Magee %-)
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com (mailto:django...@googlegroups.com).
> To unsubscribe from this group, send email to django-users...@googlegroups.com (mailto:django-users...@googlegroups.com).
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
Field objects take 'connection' and 'prepared' kwargs in Django 1.4. It sounds like you're using a custom field which was written before those parameters existed, or perhaps you upgraded from a previous version and didn't delete all the .pyc files.
If it's the latter, it's a good idea to completely delete your Django directory from site-packages before re-installing. If it's the former, you can add the kwargs with a default of None and pass the values to the super() call.
This is probably not true; you'll have to run your delpyc script on your
virtualenv (or Python site-packages) folder to ensure that the problem
you have isn't being caused by a zombie .pyc file in an installed
package. Running it in the project folder only deletes .pyc files you wrote.
Just a nitpicky point, but I wanted to point it out in case anyone else
followed this thread, deleted .pyc files in their project and wrongly
went on to a frustrating wild goose chase assuming they already ruled
out this problem.
Shawn
Minor nit; .pyc files are, well, 'files', and so should not need
recursive or forced rm. Hence:
alias delpyc='find . -type f -name "*.pyc" -print0 | xargs -0 rm'
Cheers
Tom