Coverage for gws-app/gws/base/project/action.py: 100%
19 statements
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-16 23:09 +0200
« prev ^ index » next coverage.py v7.11.0, created at 2025-10-16 23:09 +0200
1from typing import Optional
3import gws
4import gws.base.action
5import gws.base.auth.user
6import gws.lib.intl
9gws.ext.new.action('project')
12class Config(gws.base.action.Config):
13 """Project info action configuration."""
15 pass
18class Props(gws.base.action.Props):
19 pass
22class InfoResponse(gws.Response):
23 project: gws.ext.props.project
24 locale: gws.Locale
25 user: Optional[gws.base.auth.user.Props]
28class Object(gws.base.action.Object):
29 """Project information action"""
31 @gws.ext.command.api('projectInfo')
32 def info(self, req: gws.WebRequester, p: gws.Request) -> InfoResponse:
33 """Return the project configuration"""
35 project = req.user.require_project(p.projectUid)
37 return InfoResponse(
38 project=gws.props_of(project, req.user),
39 locale=gws.lib.intl.locale(p.localeUid, project.localeUids),
40 user=None if req.user.isGuest else gws.props_of(req.user, req.user),
41 )