feat: add baseView component with initial structure and rendering logic
The baseView component provides a foundational view layer for the application, including basic rendering and lifecycle methods to support future view extensions.
This commit is contained in:
parent
5ed039f262
commit
421abd67f6
@ -23,6 +23,21 @@ def get_timestamp():
|
|||||||
formatted_datetime = now.strftime("%Y-%m-%d %H:%M:%S")
|
formatted_datetime = now.strftime("%Y-%m-%d %H:%M:%S")
|
||||||
return formatted_datetime
|
return formatted_datetime
|
||||||
|
|
||||||
|
class BaseView(web.View):
|
||||||
|
|
||||||
|
@property
|
||||||
|
def app(self):
|
||||||
|
return self.request.app
|
||||||
|
|
||||||
|
@property
|
||||||
|
def template_path(self):
|
||||||
|
return pathlib.Path(self.request.app.template_path)
|
||||||
|
|
||||||
|
async def render_template(self, name, context=None):
|
||||||
|
if not context:
|
||||||
|
context = {}
|
||||||
|
return await self.request.app.render_template(str(name), self.request, context)
|
||||||
|
|
||||||
|
|
||||||
class BaseApplication(RPCApplication):
|
class BaseApplication(RPCApplication):
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user