You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2022/11/09 19:51:57 UTC
[allura] branch db/410_gone created (now 9774cd4f0)
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a change to branch db/410_gone
in repository https://gitbox.apache.org/repos/asf/allura.git
at 9774cd4f0 type hint for chunked_find
This branch includes the following new commits:
new c061d5ecf use error template for 410 Gone statuses too
new 9774cd4f0 type hint for chunked_find
The 2 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.
[allura] 02/02: type hint for chunked_find
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/410_gone
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 9774cd4f053cf0baba85b56e6ce2c02addb95a18
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Nov 9 14:51:48 2022 -0500
type hint for chunked_find
---
Allura/allura/lib/utils.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/Allura/allura/lib/utils.py b/Allura/allura/lib/utils.py
index 41b2c979f..6dca2dc8b 100644
--- a/Allura/allura/lib/utils.py
+++ b/Allura/allura/lib/utils.py
@@ -14,9 +14,10 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
+from __future__ import annotations
import base64
-import operator
+from collections.abc import Iterable
from contextlib import contextmanager
import time
import string
@@ -28,6 +29,7 @@ import datetime
import random
import mimetypes
import re
+from typing import Type, TypeVar
import magic
from itertools import groupby
import operator as op
@@ -37,7 +39,6 @@ from six.moves.urllib.parse import urlparse
import six.moves.urllib.request
import six.moves.urllib.parse
import six.moves.urllib.error
-import types
import socket
import tg
@@ -61,6 +62,10 @@ from ming.odm.odmsession import ODMCursor
from ming.odm import session
import six
+
+T = TypeVar('T')
+
+
MARKDOWN_EXTENSIONS = ['.markdown', '.mdown', '.mkdn', '.mkd', '.md']
@@ -154,7 +159,8 @@ class CustomWatchedFileHandler(logging.handlers.WatchedFileHandler):
return super().format(record)
-def chunked_find(cls, query=None, pagesize=1024, sort_key='_id', sort_dir=1):
+def chunked_find(cls: Type[T], query: dict | None = None, pagesize: int = 1024, sort_key: str | None = '_id',
+ sort_dir: int = 1) -> Iterable[Iterable[T]]:
'''
Execute a mongo query against the specified class, yield some results at
a time (avoids mongo cursor timeouts if the total result set is very large).
[allura] 01/02: use error template for 410 Gone statuses too
Posted by br...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/410_gone
in repository https://gitbox.apache.org/repos/asf/allura.git
commit c061d5ecfea829895361daa0c089848464880e3e
Author: Dave Brondsema <db...@slashdotmedia.com>
AuthorDate: Wed Nov 9 14:51:35 2022 -0500
use error template for 410 Gone statuses too
---
Allura/allura/config/app_cfg.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Allura/allura/config/app_cfg.py b/Allura/allura/config/app_cfg.py
index 54b72eb48..5c0a3678f 100644
--- a/Allura/allura/config/app_cfg.py
+++ b/Allura/allura/config/app_cfg.py
@@ -61,7 +61,7 @@ class ForgeConfig(AppConfig):
self.use_sqlalchemy = False
self.use_toscawidgets = False
self.use_transaction_manager = False
- self.handle_status_codes = [403, 404]
+ self.handle_status_codes = [403, 404, 410]
self.disable_request_extensions = True
# if left to True (default) would use crank.util.default_path_translator to convert all URL punctuation to "_"