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 2022/11/10 16:52:50 UTC

[allura] branch master updated (e7f78cec4 -> c3daf98f3)

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 e7f78cec4 ignore a pure reformatting change
     new adbe83f76 use error template for 410 Gone statuses too
     new c3daf98f3 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.


Summary of changes:
 Allura/allura/config/app_cfg.py |  2 +-
 Allura/allura/lib/utils.py      | 12 +++++++++---
 2 files changed, 10 insertions(+), 4 deletions(-)


[allura] 01/02: use error template for 410 Gone statuses too

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 adbe83f76a7a4cc5c00a061d218b0b5cbb622b3a
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 "_"


[allura] 02/02: type hint for chunked_find

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 c3daf98f3405f59c9bbe9bc2f3b03a8c8b092088
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).