My SiteUser model allows an avatar upload. If there's not one, it
assigns a default image on save:

def save(self, *args, **kwargs):
     ...
    if self.avatar is None:
         self.avatar = "img/avatars/default.gif"

    super(SiteUser, self).save(*args, **kwargs)

Pretty straightforward. Problem, is, later when I try to get height of
avatar (siteuser.avatar.height) It fails whenever the avatar is
default. gif with a suspicious operation error:

...
 File "/home/grmadmin/webapps/django/lib/python2.5/django/core/files/
storage.py", line 204, in path
   raise SuspiciousOperation("Attempted access to '%s' denied." %
name)

SuspiciousOperation: Attempted access to '/img/avatars/default.gif'
denied.

I've checked permissions on default.gif, but that doesn't appear to be
it.
I can call siteuser.avatar with no problem, but siteuser.avatar.height
fails every time, if the avatar is default.gif



--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to