-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: custom MARTOR_UPLOAD_URL not working #210
- Loading branch information
Agus Makmun
committed
Mar 15, 2024
1 parent
fdadca8
commit 7868518
Showing
19 changed files
with
109 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
__VERSION__ = "1.6.37" | ||
__RELEASE_DATE__ = "09-Mar-2024" | ||
__VERSION__ = "1.6.38" | ||
__RELEASE_DATE__ = "15-Mar-2024" | ||
__AUTHOR__ = "Agus Makmun (Summon Agus)" | ||
__AUTHOR_EMAIL__ = "[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
import django | ||
from django.urls import include, path | ||
|
||
from .views import TestFormView | ||
|
||
|
||
if django.VERSION >= (2, 0): | ||
from django.urls import path, include | ||
|
||
urlpatterns = [ | ||
path("test-form-view/", TestFormView.as_view()), | ||
path("", include("martor.urls")), | ||
] | ||
else: | ||
from django.conf.urls import url, include | ||
|
||
urlpatterns = [ | ||
url(r"^test-form-view/$", TestFormView.as_view()), | ||
url(r"^martor/", include("martor.urls")), | ||
] | ||
urlpatterns = [ | ||
path("test-form-view/", TestFormView.as_view()), | ||
path("martor/", include("martor.urls")), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,75 +1,9 @@ | ||
import django | ||
from django.urls import path | ||
|
||
from .settings import MARTOR_MARKDOWNIFY_URL, MARTOR_UPLOAD_URL, MARTOR_SEARCH_USERS_URL | ||
from .views import ( | ||
markdownfy_view, | ||
markdown_imgur_uploader, | ||
markdown_search_user, | ||
) | ||
from .views import markdown_imgur_uploader, markdown_search_user, markdownfy_view | ||
|
||
|
||
def __normalize(path: str) -> str: | ||
# to support Python < 3.9 we can't use removeprefix('/').removesuffix('/') | ||
if path.startswith("/"): | ||
path = path[1:] | ||
if path.endswith("/"): | ||
path = path[:-1] | ||
return path | ||
|
||
|
||
if django.VERSION >= (2, 0): | ||
from django.urls import path | ||
|
||
urlpatterns = [ | ||
path( | ||
f"{__normalize(MARTOR_MARKDOWNIFY_URL)}/", | ||
markdownfy_view, | ||
name="martor_markdownfy", | ||
), | ||
] | ||
|
||
if MARTOR_UPLOAD_URL: | ||
urlpatterns.append( | ||
path( | ||
f"{__normalize(MARTOR_UPLOAD_URL)}/", | ||
markdown_imgur_uploader, | ||
name="imgur_uploader", | ||
), | ||
) | ||
|
||
if MARTOR_SEARCH_USERS_URL: | ||
urlpatterns.append( | ||
path( | ||
f"{__normalize(MARTOR_SEARCH_USERS_URL)}/", | ||
markdown_search_user, | ||
name="search_user_json", | ||
), | ||
) | ||
else: | ||
from django.conf.urls import url | ||
|
||
urlpatterns = [ | ||
url( | ||
r"^%s/$" % __normalize(MARTOR_MARKDOWNIFY_URL), | ||
markdownfy_view, | ||
name="martor_markdownfy" | ||
), | ||
] | ||
|
||
if MARTOR_UPLOAD_URL: | ||
urlpatterns.append( | ||
url( | ||
r"^%s/$" % __normalize(MARTOR_UPLOAD_URL), | ||
markdown_imgur_uploader, | ||
name="imgur_uploader", | ||
), | ||
) | ||
|
||
if MARTOR_SEARCH_USERS_URL: | ||
urlpatterns.append( | ||
url( | ||
r"^%s/$" % __normalize(MARTOR_SEARCH_USERS_URL), | ||
markdown_search_user, | ||
name="search_user_json", | ||
), | ||
) | ||
urlpatterns = [ | ||
path("markdownify/", markdownfy_view, name="martor_markdownfy"), | ||
path("uploader/", markdown_imgur_uploader, name="imgur_uploader"), | ||
path("search-user/", markdown_search_user, name="search_user_json"), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.