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 22:59 +0200

1from typing import Optional 

2 

3import gws 

4import gws.base.action 

5import gws.base.auth.user 

6import gws.lib.intl 

7 

8 

9gws.ext.new.action('project') 

10 

11 

12class Config(gws.base.action.Config): 

13 """Project info action configuration.""" 

14 

15 pass 

16 

17 

18class Props(gws.base.action.Props): 

19 pass 

20 

21 

22class InfoResponse(gws.Response): 

23 project: gws.ext.props.project 

24 locale: gws.Locale 

25 user: Optional[gws.base.auth.user.Props] 

26 

27 

28class Object(gws.base.action.Object): 

29 """Project information action""" 

30 

31 @gws.ext.command.api('projectInfo') 

32 def info(self, req: gws.WebRequester, p: gws.Request) -> InfoResponse: 

33 """Return the project configuration""" 

34 

35 project = req.user.require_project(p.projectUid) 

36 

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 )