Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

23 lines (19 sloc) 0.679 kb
# encoding: utf-8
# Copyright 2011 Limited
# This file is part of Treeio.
# License
Custom storage for Documents to allow dynamic MEDIA_ROOT paths
from import FileSystemStorage
from django.core.exceptions import SuspiciousOperation
from django.utils._os import safe_join
from treeio.core.conf import settings
import os
class FileStorage(FileSystemStorage):
def path(self, name):
path = safe_join(getattr(settings, 'MEDIA_ROOT'), name)
except ValueError:
raise SuspiciousOperation("Attempted access to '%s' denied." % name)
return os.path.normpath(path)
Jump to Line
Something went wrong with that request. Please try again.