In mailer.engine.send_all() a FileLock is created this way:
lock = FileLock("send_mail")
In FileLock.__init_(), os.path.abspath is used to get the absolute path to
that filename -- "on most platforms, this is equivalent to
normpath(join(os.getcwd(), path))" [1] -- so if the current working
directory is not writable this will raise a LockFailed exception.
Relying on the cwd its a bad idea for web aplication, as Graham Dumpleton
commented on django-users [2] some time ago, quoting him:
"Python web frameworks or applications which have to one degree or
another made a choice to somehow rely on the current working directory
being a specific value are limiting the deployment choices for their
users by doing so. You are thus highly discouraged against doing it
and using __file__ as an anchor or a variable setting in main settings
configuration file is a better and more portable way of doing it."
Trying to keep it simple I work around it making the path relative to the
app_dir using __file__. This worked for me but note that is not a perfect
solution, a setting to override this is needed for some setups.
Patch attached.
[1]: http://docs.python.org/library/os.path.html#os.path.abspath
[2]: http://groups.google.com/group/django-users/msg/51d3f6b6e5c382ba
Original issue reported on code.google.com by gonzalosaavedra on 1 Apr 2009 at 3:02
Original issue reported on code.google.com by
gonzalosaavedra
on 1 Apr 2009 at 3:02Attachments: