cubicweb#
CubicWeb is a generic framework to quickly build applications which describes relations between entitites.
Exceptions#
Base exceptions#
- exception cubicweb.ProgrammingError[source]#
Bases:
ExceptionException raised for errors that are related to the databaseâs operation and not necessarily under the control of the programmer, e.g. an unexpected disconnect occurs, the data source name is not found, a transaction could not be processed, a memory allocation error occurred during processing, etc.
- exception cubicweb.CubicWebException[source]#
Bases:
Exceptionbase class for cubicweb server exception
- exception cubicweb.InternalError[source]#
Bases:
cubicweb._exceptions.CubicWebExceptionbase class for exceptions which should not occur
- exception cubicweb.SecurityError[source]#
Bases:
cubicweb._exceptions.CubicWebExceptionbase class for cubicweb server security exceptions
- exception cubicweb.RepositoryError[source]#
Bases:
cubicweb._exceptions.CubicWebExceptionbase class for repository exceptions
- exception cubicweb.SourceException[source]#
Bases:
cubicweb._exceptions.CubicWebExceptionbase class for source exceptions
- exception cubicweb.CubicWebRuntimeError[source]#
Bases:
cubicweb._exceptions.CubicWebExceptionbase class for runtime exceptions
Repository exceptions#
- exception cubicweb.ConnectionError[source]#
Bases:
cubicweb._exceptions.RepositoryErrorraised when a bad connection id is given or when an attempt to establish a connection failed
- exception cubicweb.AuthenticationError[source]#
Bases:
cubicweb._exceptions.ConnectionErrorraised when an attempt to establish a connection failed due to wrong connection information (login / password or other authentication token)
- exception cubicweb.BadConnectionId[source]#
Bases:
cubicweb._exceptions.ConnectionErrorraised when a bad connection id is given
- exception cubicweb.UnknownEid[source]#
Bases:
cubicweb._exceptions.RepositoryErrorthe eid is not defined in the system tables
- exception cubicweb.UniqueTogetherError(session, **kwargs)[source]#
Bases:
cubicweb._exceptions.RepositoryErrorraised when a unique_together constraint caused an IntegrityError
Security Exceptions#
- exception cubicweb.Unauthorized[source]#
Bases:
cubicweb._exceptions.SecurityErrorraised when a user tries to perform an action without sufficient credentials
- exception cubicweb.Forbidden[source]#
Bases:
cubicweb._exceptions.SecurityErrorraised when a user tries to perform a forbidden action
Source exceptions#
- exception cubicweb.EidNotInSource[source]#
Bases:
cubicweb._exceptions.SourceExceptiontrying to access an object with a particular eid from a particular source has failed
Registry exceptions#
- exception cubicweb.UnknownProperty[source]#
Bases:
logilab.common.registry.RegistryExceptionproperty found in database but unknown in registry
Query exceptions#
- exception cubicweb.QueryError[source]#
Bases:
cubicweb._exceptions.CubicWebRuntimeErrora query try to do something it shouldnât
- exception cubicweb.NotAnEntity[source]#
Bases:
cubicweb._exceptions.CubicWebRuntimeErrorraised when get_entity is called for a column which doesnât contain a non final entity
- exception cubicweb.MultipleResultsError[source]#
Bases:
cubicweb._exceptions.CubicWebRuntimeErrorraised when ResultSet.one() is called on a resultset with multiple rows of multiple columns.
- exception cubicweb.NoResultError[source]#
Bases:
cubicweb._exceptions.CubicWebRuntimeErrorraised when no result is found but at least one is expected.
- exception cubicweb.UndoTransactionException(txuuid, errors)[source]#
Bases:
cubicweb._exceptions.QueryErrorRaised when undoing a transaction could not be performed completely.
- Note that :
the partial undo operation might be acceptable depending upon the final application
the undo operation can also fail with a ValidationError in cases where the undoing breaks integrity constraints checked immediately.
It might be that neither of those exception is raised but a subsequent commit might raise a ValidationError in cases where the undoing breaks integrity constraints checked at commit time.
- Parameters
txuuid â Unique identifier of the partially undone transaction
errors (list) â List of errors occurred during undoing
Misc#
- exception cubicweb.ConfigurationError[source]#
Bases:
cubicweb._exceptions.CubicWebExceptiona misconfiguration error
- exception cubicweb.ExecutionError[source]#
Bases:
Exceptionserver execution control error (already started, not runningâŠ)
- exception cubicweb.BadCommandUsage[source]#
Bases:
ExceptionRaised when an unknown command is used or when a command is not correctly used (bad options, too much / missing argumentsâŠ).
Trigger display of command usage.
- exception cubicweb.ValidationError(entity, errors: Dict, msgargs: Optional[Dict] = None, i18nvalues: Optional[List] = None)[source]#
Bases:
yams._exceptions.SchemaErrorValidation error details the reason(s) why the validation failed.
Arguments are:
entity: the entity that could not be validated; actual type depends on the client library
errors: errors dictionary, None key used for global error, other keys should be attribute/relation of the entity, qualified as subject/object using
yams.role_name(). Values are the message associated to the keys, and may include interpolation string starting with â%(KEY-â where âKEYâ will be replaced by the associated key once the message has been translated. This allows predictable/translatable message and avoid args conflict if used for several keys.msgargs: dictionary of substitutions to be inserted in error messages once translated (only if msgargs is given)
i18nvalues: list of keys in msgargs whose value should be translated
Translation will be done in-place by calling
translate().
Utilities#
- class cubicweb.Binary(buf=b'')[source]#
class to hold binary data. Use BytesIO to prevent use of unicode data
- class cubicweb.CubicWebEventManager[source]#
simple event / callback manager.
Typical usage to register a callback:
>>> from cubicweb import CW_EVENT_MANAGER >>> CW_EVENT_MANAGER.bind('after-registry-reload', mycallback)
Typical usage to emit an event:
>>> from cubicweb import CW_EVENT_MANAGER >>> CW_EVENT_MANAGER.emit('after-registry-reload')
emit() accepts an additional context parameter that will be passed to the callback if specified (and only in that case)
- cubicweb.onevent(event, *args, **kwargs)[source]#
decorator to ease event / callback binding
>>> from cubicweb import onevent >>> @onevent('before-registry-reload') ... def mycallback(): ... print 'hello' ... >>>
- cubicweb.validation_error(entity, errors, substitutions=None, i18nvalues=None)[source]#
easy way to retrieve a
cubicweb.ValidationErrorfor an entity or eid.You may also have 2-tuple as error keys,
yams.role_name()will be called automatically for them.Messages in errors should not be translated yet, though marked for internationalization. You may give an additional substition dictionary that will be used for interpolation after the translation.