Skip to content

Instantly share code, notes, and snippets.

@jarvys
Created May 13, 2014 11:54
Show Gist options
  • Save jarvys/9001f012414e3e04c4bf to your computer and use it in GitHub Desktop.
Save jarvys/9001f012414e3e04c4bf to your computer and use it in GitHub Desktop.
def path_prefix(path):
    def wrapper(instance, filename):
        ext = filename.split('.')[-1]
        filename = '{}.{}'.format(uuid4().hex, ext)
        return os.path.join(path, filename)
    return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment