Coverage for gws-app/gws/base/__init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""Base classes of the configurable objects. 

2 

3This package holds the base classes, managers and actions of the objects that 

4make up a GBD WebSuite application. Most interfaces they implement are declared 

5in the ``types.pyinc`` files of the subpackages and exported as ``gws.*`` 

6types. Concrete object types (layer types, auth providers, templates, model 

7fields and so on) live in ``gws.plugin`` and subclass the classes here. 

8 

9Subpackages: 

10 

11- ``action``: server actions, the base class of all actions and the action manager. 

12- ``application``: the application object, the root node of the object tree. 

13- ``auth``: authentication and authorization: the auth manager, base classes 

14 for auth methods, providers, MFA adapters and session managers, and users. 

15- ``client``: browser client configuration (UI elements, options) and client bundles. 

16- ``database``: database providers and the database layer, model and auth provider base classes. 

17- ``edit``: feature editing, the ``edit`` action and helper. 

18- ``exporter``: feature export to files, run as background jobs. 

19- ``feature``: the feature implementation. 

20- ``grabber``: raster grabbers, which fetch, warp, cache and serve layer images. 

21- ``job``: background jobs and the job manager. 

22- ``layer``: base classes and utilities for map layers. 

23- ``legend``: base classes for layer legends. 

24- ``map``: maps and the ``map`` action. 

25- ``metadata``: OWS and ISO 19115 metadata. 

26- ``model``: data models and their fields, values, validators and widgets. 

27- ``ows``: common base for OWS clients and servers. 

28- ``printer``: printing to PDF or PNG. 

29- ``project``: projects and the ``project`` action. 

30- ``search``: search queries, finders and the search manager. 

31- ``storage``: storage for data saved by users. 

32- ``template``: templates and the template manager. 

33- ``web``: the WSGI application, web site settings and the ``web`` action. 

34 

35How they relate: 

36 

37The application (``application``) is created from the root configuration and 

38creates the managers (auth, database, models, search, templates, printers, 

39jobs, web and others), the global objects and the projects. Other objects 

40reach them through ``root.app``. A project (``project``) has a map (``map``) 

41with a tree of layers (``layer``). Layers have legends (``legend``), 

42metadata (``metadata``), templates (``template``), finders (``search``) and 

43models (``model``). Models read and write features (``feature``) with 

44geometries (``gws.lib.shape``) from their sources, for example databases 

45(``database``). Image layers render through grabbers (``grabber``). Actions 

46(``action``) expose commands to the client; long running tasks such as 

47printing (``printer``) and exporting (``exporter``) run as background jobs 

48(``job``). Each web request passes through the WSGI application (``web``), 

49which runs the middleware (for example ``auth``) and dispatches the command 

50to an action. 

51 

52``gws.base`` imports from ``gws.core``, ``gws.lib``, ``gws.gis``, 

53``gws.config``, ``gws.spec`` and ``gws.server``, never from ``gws.plugin``. 

54 

55Example:: 

56 

57 import gws 

58 import gws.base.layer 

59 import gws.lib.shape 

60 import gws.lib.crs 

61 

62 shape = gws.lib.shape.from_xy(100, 200, gws.lib.crs.WEBMERCATOR) 

63 

64 @gws.ext.object.layer('my') 

65 class Object(gws.base.layer.image.Object): 

66 def configure(self): 

67 self.configure_layer() 

68"""