-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove the singular JsonLogger in favor of the uw-it-flask-gunicorn-j…
…son-logger package (#136) * Remove the singular JsonLogger component and use the new, shared one instead. :) Please note that the `@logged_timer` function in the new package does not yet have features that are implemented in the current `@timed` decorator in this package, so I haven't stripped that out yet. (i.e., we're still using the existing timers.) * [Bot] Update version to 2.1.10 Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a2c00aa
commit 62f2ad0
Showing
14 changed files
with
63 additions
and
266 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
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,5 +1,4 @@ | ||
from base64 import b64decode | ||
from logging import Logger | ||
from typing import Optional, Union | ||
|
||
from flask import ( | ||
|
@@ -27,6 +26,7 @@ | |
) | ||
from husky_directory.services.search import DirectorySearchService | ||
from husky_directory.services.vcard import VCardService | ||
from husky_directory.util import AppLoggerMixIn | ||
|
||
|
||
class ErrorModel(DirectoryBaseModel): | ||
|
@@ -46,12 +46,11 @@ class Config(DirectoryBaseModel.Config): | |
|
||
|
||
@singleton | ||
class SearchBlueprint(Blueprint): | ||
class SearchBlueprint(Blueprint, AppLoggerMixIn): | ||
@inject | ||
def __init__(self, logger: Logger, injector: Injector): | ||
def __init__(self, injector: Injector): | ||
super().__init__("search", __name__) | ||
self.injector = injector | ||
self.logger = logger | ||
self.add_url_rule("/", view_func=self.index, methods=("GET",)) | ||
self.add_url_rule("/", view_func=self.search_listing, methods=("POST",)) | ||
self.add_url_rule( | ||
|
@@ -84,10 +83,9 @@ def index(request: Request, session: LocalProxy, settings: ApplicationConfig): | |
200, | ||
) | ||
|
||
@staticmethod | ||
def get_person_listing( | ||
self, | ||
request: Request, | ||
logger: Logger, | ||
session: LocalProxy, | ||
service: DirectorySearchService, | ||
): | ||
|
@@ -103,7 +101,7 @@ def get_person_listing( | |
) | ||
except Exception as e: | ||
template = "views/index.html" | ||
logger.exception(str(e)) | ||
self.logger.exception(str(e)) | ||
SearchBlueprint.handle_search_exception(e, context) | ||
finally: | ||
return ( | ||
|
@@ -141,11 +139,10 @@ def handle_search_exception(e: Exception, context: RenderingContext): | |
"email [email protected] describing your problem." | ||
) | ||
|
||
@staticmethod | ||
def search_listing( | ||
self, | ||
request: Request, | ||
service: DirectorySearchService, | ||
logger: Logger, | ||
session: LocalProxy, | ||
settings: ApplicationConfig, | ||
): | ||
|
@@ -160,7 +157,7 @@ def search_listing( | |
request_input = SearchDirectoryInput.from_form_input(form_input) | ||
context.search_result = service.search_directory(request_input) | ||
except Exception as e: | ||
logger.exception(str(e)) | ||
self.logger.exception(str(e)) | ||
SearchBlueprint.handle_search_exception(e, context) | ||
finally: | ||
response: Response = make_response( | ||
|
This file was deleted.
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
Oops, something went wrong.