You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by gc...@apache.org on 2023/03/17 16:08:37 UTC
[allura] branch master updated (afa735794 -> 474a79978)
This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
from afa735794 bump ming version
new 0ebdfd095 [#8503] deprecation warnings - fixed using collections instead of collections.abc
new ea197dfbe [#8503] deprecation warnings - fix markdown extension registration warnings
new 599de96b2 [#8503] deprecation warnings - fix misc Decoration.validation -> Decoration.validations warning
new 474a79978 [#8503] pytest - update configuration of which warnings to ignore
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
Allura/allura/lib/markdown_extensions.py | 54 +++++++++++++++++++-------------
Allura/allura/lib/utils.py | 6 ++--
ForgeImporters/forgeimporters/base.py | 2 +-
pytest.ini | 8 ++++-
4 files changed, 44 insertions(+), 26 deletions(-)
[allura] 04/04: [#8503] pytest - update configuration of which warnings to ignore
Posted by gc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 474a799786c077fd2a4bfacb00eb2eb806a7e3ae
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Wed Mar 8 02:31:01 2023 +0000
[#8503] pytest - update configuration of which warnings to ignore
---
pytest.ini | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/pytest.ini b/pytest.ini
index df269e9ad..1ad2b5ecf 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -20,7 +20,13 @@
# https://docs.python.org/3/using/cmdline.html#cmdoption-w
# https://docs.pytest.org/en/6.2.x/reference.html#ini-options-ref
filterwarnings =
- ignore::DeprecationWarning
+ ignore::DeprecationWarning:html5lib.filters.sanitizer
+ # https://bizxinfo.atlassian.net/browse/SF-6067
+ ignore::DeprecationWarning:ming
+ # not sure why timermiddleware is surfacing pymongo warnings, but it does:
+ ignore:insert is deprecated. Use insert_one or insert_many instead.:DeprecationWarning:timermiddleware
+ ignore:update is deprecated. Use replace_one, update_one or update_many instead.:DeprecationWarning:timermiddleware
+ ignore:remove is deprecated. Use delete_one or delete_many instead.:DeprecationWarning:timermiddleware
addopts = --pyargs -p no:flaky
[allura] 02/04: [#8503] deprecation warnings - fix markdown extension registration warnings
Posted by gc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit ea197dfbe68cdbb9425f742404c8e85685306e28
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Wed Mar 8 02:17:00 2023 +0000
[#8503] deprecation warnings - fix markdown extension registration warnings
---
Allura/allura/lib/markdown_extensions.py | 54 +++++++++++++++++++-------------
1 file changed, 33 insertions(+), 21 deletions(-)
diff --git a/Allura/allura/lib/markdown_extensions.py b/Allura/allura/lib/markdown_extensions.py
index 468469d77..f87c18ce1 100644
--- a/Allura/allura/lib/markdown_extensions.py
+++ b/Allura/allura/lib/markdown_extensions.py
@@ -103,20 +103,27 @@ class CommitMessageExtension(markdown.Extension):
md.registerExtension(self)
# remove default preprocessors and add our own
clear_markdown_registry(md.preprocessors)
- md.preprocessors['trac_refs'] = PatternReplacingProcessor(TracRef1(), TracRef2(), TracRef3(self.app))
+
+ # The last param of .register() is priority. Higher vals go first.
+
+ md.preprocessors.register(PatternReplacingProcessor(TracRef1(), TracRef2(), TracRef3(self.app)), 'trac_refs', 0)
+
# remove all inlinepattern processors except short refs and links
clear_markdown_registry(md.inlinePatterns, keep=['link'])
- md.inlinePatterns['short_reference'] = ForgeLinkPattern(SHORT_REF_RE, md, ext=self)
+ md.inlinePatterns.register(ForgeLinkPattern(SHORT_REF_RE, md, ext=self), 'short_reference', 0)
+
# remove all default block processors except for paragraph
clear_markdown_registry(md.parser.blockprocessors, keep=['paragraph'])
+
# wrap artifact link text in square brackets
self.forge_link_tree_processor = ForgeLinkTreeProcessor(md)
- md.treeprocessors['links'] = self.forge_link_tree_processor
+ md.treeprocessors.register(self.forge_link_tree_processor, 'links', 0)
+
# Sanitize HTML
- md.postprocessors['sanitize_html'] = HTMLSanitizer()
+ md.postprocessors.register(HTMLSanitizer(), 'sanitize_html', 3)
# Put a class around markdown content for custom css
- md.postprocessors['add_custom_class'] = AddCustomClass()
- md.postprocessors['mark_safe'] = MarkAsSafe()
+ md.postprocessors.register(AddCustomClass(), 'add_custom_class', 2)
+ md.postprocessors.register(MarkAsSafe(), 'mark_safe', 1)
def reset(self):
self.forge_link_tree_processor.reset()
@@ -272,27 +279,32 @@ class ForgeExtension(markdown.Extension):
def extendMarkdown(self, md):
md.registerExtension(self)
- md.preprocessors.add('macro_include', ForgeMacroIncludePreprocessor(md), '_end')
+ md.preprocessors.register(ForgeMacroIncludePreprocessor(md), 'macro_include', -99)
+
+ # The last param of .register() is priority. Higher vals go first.
+
# this has to be before the 'escape' processor, otherwise weird
# placeholders are inserted for escaped chars within urls, and then the
# autolink can't match the whole url
- md.inlinePatterns.add('autolink_without_brackets',
- AutolinkPattern(r'(http(?:s?)://[a-zA-Z0-9./\-\\_%?&=+#;~:!]+)', md),
- '<escape')
+ md.inlinePatterns.register(AutolinkPattern(r'(http(?:s?)://[a-zA-Z0-9./\-\\_%?&=+#;~:!]+)', md),
+ 'autolink_without_brackets',
+ 185) # was '<escape' and 'escape' is priority 180; great num runs first, so: 185
# replace the link pattern with our extended version
- md.inlinePatterns['link'] = ForgeLinkPattern(FORGE_LINK_RE, md, ext=self)
- md.inlinePatterns['short_reference'] = ForgeLinkPattern(SHORT_REF_RE, md, ext=self)
+ md.inlinePatterns.register(ForgeLinkPattern(FORGE_LINK_RE, md, ext=self), 'link', 160)
+ md.inlinePatterns.register(ForgeLinkPattern(SHORT_REF_RE, md, ext=self), 'short_reference', 130)
# macro must be processed before links
- md.inlinePatterns.add('macro', ForgeMacroPattern(MACRO_PATTERN, md, ext=self), '<link')
+ md.inlinePatterns.register(ForgeMacroPattern(MACRO_PATTERN, md, ext=self), 'macro', 165) # similar to above
+
self.forge_link_tree_processor = ForgeLinkTreeProcessor(md)
- md.treeprocessors['links'] = self.forge_link_tree_processor
+ md.treeprocessors.register(self.forge_link_tree_processor, 'links', 100)
+
# Sanitize HTML
- md.postprocessors['sanitize_html'] = HTMLSanitizer()
+ md.postprocessors.register(HTMLSanitizer(), 'sanitize_html', 5)
# Rewrite all relative links that don't start with . to have a '../' prefix
- md.postprocessors['rewrite_relative_links'] = RelativeLinkRewriter(make_absolute=self._is_email)
+ md.postprocessors.register(RelativeLinkRewriter(make_absolute=self._is_email), 'rewrite_relative_links', 4)
# Put a class around markdown content for custom css
- md.postprocessors['add_custom_class'] = AddCustomClass()
- md.postprocessors['mark_safe'] = MarkAsSafe()
+ md.postprocessors.register(AddCustomClass(), 'add_custom_class', 3)
+ md.postprocessors.register(MarkAsSafe(), 'mark_safe', 2)
def reset(self):
self.forge_link_tree_processor.reset()
@@ -304,7 +316,7 @@ class EmojiExtension(markdown.Extension):
def extendMarkdown(self, md):
md.registerExtension(self)
- md.inlinePatterns["emoji"] = EmojiInlinePattern(self.EMOJI_RE)
+ md.inlinePatterns.register(EmojiInlinePattern(self.EMOJI_RE), 'emoji', 0)
class EmojiInlinePattern(markdown.inlinepatterns.Pattern):
@@ -320,7 +332,7 @@ class UserMentionExtension(markdown.Extension):
def extendMarkdown(self, md):
md.registerExtension(self)
- md.inlinePatterns["user_mentions"] = UserMentionInlinePattern(self.UM_RE)
+ md.inlinePatterns.register(UserMentionInlinePattern(self.UM_RE), 'user_mentions', 0)
class UserMentionInlinePattern(markdown.inlinepatterns.Pattern):
@@ -424,7 +436,7 @@ class ForgeMacroPattern(markdown.inlinepatterns.Pattern):
def handleMatch(self, m):
html = self.macro(m.group(2))
- placeholder = self.markdown.htmlStash.store(html)
+ placeholder = self.md.htmlStash.store(html)
return placeholder
[allura] 01/04: [#8503] deprecation warnings - fixed using collections instead of collections.abc
Posted by gc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 0ebdfd095af7bf0ea7c2ac25c01d2ae15b8598de
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Wed Mar 8 02:15:39 2023 +0000
[#8503] deprecation warnings - fixed using collections instead of collections.abc
---
Allura/allura/lib/utils.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index 396ad7ccf..c1c27e118 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -17,7 +17,7 @@
from __future__ import annotations
import base64
-from collections.abc import Iterable
+from collections.abc import Iterable, Mapping, MutableMapping
from contextlib import contextmanager
import time
import string
@@ -421,7 +421,7 @@ class TruthyCallable:
return NotImplemented
-class TransformedDict(collections.MutableMapping):
+class TransformedDict(MutableMapping):
"""
A dictionary which applies an arbitrary
@@ -807,7 +807,7 @@ def smart_str(s):
def generate_smart_str(params):
- if isinstance(params, collections.Mapping):
+ if isinstance(params, Mapping):
params_list = params.items()
else:
params_list = params
[allura] 03/04: [#8503] deprecation warnings - fix misc Decoration.validation -> Decoration.validations warning
Posted by gc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
gcruz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 599de96b2f710677ec8ad423465d3aa811cddb6c
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Wed Mar 8 02:28:44 2023 +0000
[#8503] deprecation warnings - fix misc Decoration.validation -> Decoration.validations warning
---
ForgeImporters/forgeimporters/base.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ForgeImporters/forgeimporters/base.py b/ForgeImporters/forgeimporters/base.py
index bbafbe65e..59c729acf 100644
--- a/ForgeImporters/forgeimporters/base.py
+++ b/ForgeImporters/forgeimporters/base.py
@@ -348,7 +348,7 @@ class ToolImportControllerMeta(type):
the appropriate App for this controller's importer.
"""
- if hasattr(cls, 'create') and getattr(cls.create.decoration, 'validation', None) is None:
+ if hasattr(cls, 'create') and getattr(cls.create.decoration, 'validations', None) is None:
index_meth = getattr(cls.index, '__func__', cls.index)
cls.create = validate(cls.import_form(aslist(importer.target_app)[0]),
error_handler=index_meth)(cls.create)