The docs (and an analysis of the code) indicate that the second
argument to save should be the content.

http://docs.djangoproject.com/en/dev/ref/files/file/#ref-files-file

I am assuming this is binary or text content to be written to the file
in question.  ImageFieldFile calls get_image_dimensions(content) in
save, and get_image_dimensions assumes that the input is a file or
path that can be open()ed by the file module.

The end result is that you cannot call self.imagefield.save() in a
model without an error.  Does this seem like a bug to anyone else, or
am I completely missing something?  This should probably be called on
the full filename AFTER the save to the ancestor class, so it gets
fresh cache info should manipulation occur (http://
code.djangoproject.com/ticket/8208).

Traceback:
File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py"
in get_response
  86.                 response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py"
in root
  173.                 return self.model_page(request, *url.split('/',
2))
File "/usr/lib/python2.5/site-packages/django/views/decorators/
cache.py" in _wrapped_view_func
  44.         response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/sites.py"
in model_page
  192.         return admin_obj(request, rest_of_url)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/
options.py" in __call__
  191.             return self.change_view(request, unquote(url))
File "/usr/lib/python2.5/site-packages/django/db/transaction.py" in
_commit_on_success
  238.                 res = func(*args, **kw)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/
options.py" in change_view
  570.                 self.save_model(request, new_object, form,
change=True)
File "/usr/lib/python2.5/site-packages/django/contrib/admin/
options.py" in save_model
  367.         obj.save()
File "/media/MORTON USB/sites/btevents/../btevents/photos/models.py"
in save
  20.
self.slideshow_image.save(os_path.basename(self.image.path), f.read(),
save=False)
File "/usr/lib/python2.5/site-packages/django/db/models/fields/
files.py" in save
  262.         self._dimensions_cache = get_image_dimensions(content)
File "/usr/lib/python2.5/site-packages/django/core/files/images.py" in
get_image_dimensions
  34.         file = open(file_or_path, 'rb')

Exception Type: TypeError at /admin/photos/photo/9/
Exception Value: file() argument 1 must be (encoded string without
NULL bytes), not str
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to