Skip to content

Commit

Permalink
feat(app): add BaseView
Browse files Browse the repository at this point in the history
  • Loading branch information
zluuba committed May 21, 2024
1 parent b6fce94 commit 3e8cf10
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions zluuba_art/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
# from zluuba_art.logger.logger import log


class HomeView(View):
class BaseView(View):
methods = ['GET']
init_every_request = False


class HomeView(BaseView):
def dispatch_request(self) -> ft.ResponseReturnValue:
"""
Handles the main page route, logs user statistics,
Expand All @@ -27,10 +29,7 @@ def dispatch_request(self) -> ft.ResponseReturnValue:
return render_template('index.html')


class CVPageView(View):
methods = ['GET']
init_every_request = False

class CVPageView(BaseView):
def dispatch_request(self) -> ft.ResponseReturnValue:
"""
Renders the cv page.
Expand All @@ -41,10 +40,7 @@ def dispatch_request(self) -> ft.ResponseReturnValue:
return render_template('cv.html')


class ProjectsPageView(View):
methods = ['GET']
init_every_request = False

class ProjectsPageView(BaseView):
def dispatch_request(self) -> ft.ResponseReturnValue:
"""
Renders the pet projects page.
Expand All @@ -55,10 +51,7 @@ def dispatch_request(self) -> ft.ResponseReturnValue:
return render_template('pet_projects.html')


class ProjectPageView(View):
methods = ['GET']
init_every_request = False

class ProjectPageView(BaseView):
def dispatch_request(self, *args: Any, **kwargs: Any
) -> ft.ResponseReturnValue:
"""
Expand All @@ -76,10 +69,7 @@ def dispatch_request(self, *args: Any, **kwargs: Any
return render_template(f'projects/{project_html_page}')


class LinksPageView(View):
methods = ['GET']
init_every_request = False

class LinksPageView(BaseView):
def dispatch_request(self) -> ft.ResponseReturnValue:
"""
Renders the links page.
Expand All @@ -90,10 +80,7 @@ def dispatch_request(self) -> ft.ResponseReturnValue:
return render_template('links.html')


class RobotsPageView(View):
methods = ['GET']
init_every_request = False

class RobotsPageView(BaseView):
def dispatch_request(self) -> ft.ResponseReturnValue:
"""
Serves the robots.txt file.
Expand Down

0 comments on commit 3e8cf10

Please sign in to comment.