Skip to content

Commit

Permalink
Merge pull request #56 from edx/awais786/BOM-1399__
Browse files Browse the repository at this point in the history
BOM-1399
  • Loading branch information
awais786 authored Mar 13, 2020
2 parents b86e6a2 + a7512c8 commit 3e99b06
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 29 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def build_media_pattern(base_folder, file_extension):

setup(
name = "django-wiki",
version="0.0.25",
version="0.0.26",
author="Benjamin Bach",
author_email="[email protected]",
description=("A wiki system written for the Django framework."),
Expand Down
2 changes: 1 addition & 1 deletion testproject/testproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# ('Your Name', '[email protected]'),
)

#from django.core.urlresolvers import reverse_lazy
#from django.urls import reverse_lazy
#LOGIN_REDIRECT_URL = reverse_lazy('wiki:get', kwargs={'path': ''})

# This forces the wiki login view to redirect to the referer...
Expand Down
2 changes: 1 addition & 1 deletion wiki/conf/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from __future__ import absolute_import

from django.conf import settings as django_settings
from django.core.urlresolvers import reverse_lazy
from django.urls import reverse_lazy

# Should urls be case sensitive?
URL_CASE_SENSITIVE = getattr(django_settings, 'WIKI_URL_CASE_SENSITIVE', False)
Expand Down
2 changes: 1 addition & 1 deletion wiki/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import json

from django.conf import settings as django_settings
from django.core.urlresolvers import reverse
from django.http import (HttpResponse, HttpResponseForbidden,
HttpResponseNotFound)
from django.shortcuts import get_object_or_404, redirect
from django.template.context import RequestContext
from django.template.loader import render_to_string
from django.urls import reverse
from six.moves import filter

from wiki.core.exceptions import NoRootURL
Expand Down
2 changes: 1 addition & 1 deletion wiki/editors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import

from django.core.urlresolvers import get_callable
from django.urls import get_callable

from wiki.conf import settings

Expand Down
31 changes: 14 additions & 17 deletions wiki/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,16 @@

load_wiki_plugins()

from django import shortcuts, urls

from django.core import urlresolvers
original_django_reverse = urls.reverse

original_django_reverse = urlresolvers.reverse

def reverse(*args, **kwargs):
"""Now this is a crazy and silly hack, but it is basically here to
enforce that an empty path always takes precedence over an article_id
such that the root article doesn't get resolved to /ID/ but /.
Another crazy hack that this supports is transforming every wiki url
by a function. If _transform_url is set on this function, it will
return the result of calling reverse._transform_url(reversed_url)
Expand All @@ -83,31 +83,28 @@ def reverse(*args, **kwargs):
url_kwargs.pop('article_id', None)
url_kwargs['path'] = path
kwargs['kwargs'] = url_kwargs

url = original_django_reverse(*args, **kwargs)
if hasattr(reverse, '_transform_url'):
url = reverse._transform_url(url)
else:
url = original_django_reverse(*args, **kwargs)

return url


# Now we redefine reverse method
reverse_lazy = lazy(reverse, text_type)
urlresolvers.reverse = reverse
urlresolvers.reverse_lazy = reverse_lazy
urls.reverse = reverse
urls.reverse_lazy = reverse_lazy

# Patch up other locations of the reverse function
shortcuts.reverse = reverse
try:
from django.urls import base
from django import urls
from django import shortcuts

base.reverse = reverse
base.reverse_lazy = reverse_lazy
urls.reverse = reverse
urls.reverse_lazy = reverse_lazy
shortcuts.reverse = reverse
# For Django 1.11
from django.core import urlresolvers

urlresolvers.reverse = reverse
urlresolvers.reverse_lazy = reverse_lazy
except ImportError:
pass
2 changes: 1 addition & 1 deletion wiki/models/urlpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from django.contrib.sites.models import Site
from django.contrib.sites.shortcuts import get_current_site
from django.core.exceptions import ValidationError
from django.core.urlresolvers import reverse
from django.db import models, transaction
from django.db.models.signals import post_save, pre_delete
from django.urls import reverse
from django.utils.translation import ugettext
from django.utils.translation import ugettext_lazy as _
from mptt.fields import TreeForeignKey
Expand Down
2 changes: 1 addition & 1 deletion wiki/plugins/attachments/markdown_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re

import markdown
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils.translation import ugettext as _

from wiki.plugins.attachments import models
Expand Down
2 changes: 1 addition & 1 deletion wiki/plugins/images/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import absolute_import
from django.contrib import messages
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.shortcuts import get_object_or_404, redirect
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
Expand Down
2 changes: 1 addition & 1 deletion wiki/plugins/links/wiki_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from wiki.plugins.links import views
from wiki.plugins.links.mdx.urlize import makeExtension
from wiki.plugins.links.mdx.djangowikilinks import WikiPathExtension
from django.core.urlresolvers import reverse_lazy
from django.urls import reverse_lazy


class LinkPlugin(BasePlugin):
Expand Down
2 changes: 1 addition & 1 deletion wiki/plugins/notifications/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from django.db.models import signals

Expand Down
2 changes: 1 addition & 1 deletion wiki/views/accounts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.shortcuts import redirect
from django.urls import reverse
from django.utils.translation import ugettext as _
from django.views.generic.base import View
from django.views.generic.edit import CreateView, FormView
Expand Down
2 changes: 1 addition & 1 deletion wiki/views/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.urlresolvers import reverse
from django.db import transaction
from django.db.models import Q
from django.shortcuts import get_object_or_404, redirect, render_to_response
from django.template.context import RequestContext
from django.urls import reverse
from django.utils.decorators import method_decorator
from django.utils.translation import ugettext as _
from django.views.generic.base import TemplateView, View
Expand Down

0 comments on commit 3e99b06

Please sign in to comment.