Skip to content

Commit 8bf3fd8

Browse files
jecarrKadeMorton
authored andcommitted
Made the app-instance accessible to web_svc.py
1 parent 5bbf5f1 commit 8bf3fd8

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ async def init(host, port, app_setup_func=None):
125125
app_setup_func(app)
126126

127127
aiohttp_jinja2.setup(app, loader=jinja2.FileSystemLoader(os.path.join(webapp_dir, "html")))
128+
web_svc.set_internal_app(app)
128129
runner = web.AppRunner(app)
129130
await runner.setup()
130131
await web.TCPSite(runner, host, port).start()

threadcomponents/service/web_svc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def __init__(self, route_prefix=None, is_local=True):
7070
self.categories_dict = dict()
7171
# Initialise app route info
7272
self.__app_routes = self._initialise_route_values(route_prefix_param=route_prefix)
73+
self.app = None
7374

7475
def _initialise_route_values(self, route_prefix_param=None):
7576
"""Function to initialise the web app's route values and return them as a dictionary."""
@@ -94,6 +95,9 @@ def _initialise_route_values(self, route_prefix_param=None):
9495
routes.update({self.WHAT_TO_SUBMIT_KEY: route_prefix + "/what-to-submit"})
9596
return routes
9697

98+
def set_internal_app(self, app):
99+
self.app = app
100+
97101
def get_route(self, route_key, param=None):
98102
"""Function to get one of the web app's routes with the option of a parameter to be placed in the link."""
99103
try:

0 commit comments

Comments
 (0)