gws.base.model.manager

Model manager.

Source code: gws.base.model.manager

Module Contents

class gws.base.model.manager.Object

Bases: gws.ModelManager

Model manager.

default_model()

Return the shared default model.

Returns:

The default model.

editable_models(project, user)

Return the models a user can edit in a project, together with their related models.

Parameters:
  • project – The project.

  • user – The user.

Returns:

The models, sorted by title.

find_model(*objects, user=None, access=None)

Return the first model of the given objects.

Looks in the models attribute of each object in turn.

Parameters:
  • *objects – Objects with models, e.g. layers. None values are skipped.

  • user – If given together with access, the user must have this access to the model.

  • access – The required access.

Returns:

The model, or None if none is found.

get_model(uid, user=None, access=None)

Return a model by uid.

Parameters:
  • uid – The model uid.

  • user – If given together with access, the user must have this access to the model.

  • access – The required access.

Returns:

The model, or None if it is not found or not accessible.