Permalink
Browse files

Drop "monkeypatch" as it does not have a Python 3.x port.

  • Loading branch information...
lamby committed Sep 26, 2017
1 parent 211cd2f commit 06842de41669385eec214283478c4c80a4e33296
Showing with 15 additions and 4 deletions.
  1. +0 −1 setup.py
  2. +2 −3 staticfiles_dotd/models.py
  3. +13 −0 staticfiles_dotd/utils.py
View
@@ -17,6 +17,5 @@
packages=find_packages(),
install_requires=(
'Django>=1.9.0',
'monkeypatch==0.1rc3',
),
)
@@ -1,5 +1,4 @@
import monkeypatch
from .utils import monkeypatch
from .views import serve
monkeypatch.patch(serve, 'django.contrib.staticfiles.views', 'serve')
monkeypatch(serve, 'django.contrib.staticfiles.views', 'serve')
View
@@ -1,11 +1,24 @@
import sys
import functools
import importlib
def get_dotted_path(val):
module, _, attr = val.rpartition('.')
return getattr(importlib.import_module(module), attr)
def render(filename):
# A default render method
with open(filename, 'rb') as f:
return f.read()
def monkeypatch(new, modname, target):
__import__(modname)
module = sys.modules[modname]
func = getattr(module, target)
functools.update_wrapper(new, func)
setattr(module, target, new)

0 comments on commit 06842de

Please sign in to comment.