CubicWeb is a generic framework to quickly build applications which describes relations between entitites.
- exception cubicweb.ProgrammingError¶
Exception 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¶
base class for cubicweb server exception
- exception cubicweb.InternalError¶
base class for exceptions which should not occur
- exception cubicweb.SecurityError¶
base class for cubicweb server security exceptions
- exception cubicweb.RepositoryError¶
base class for repository exceptions
- exception cubicweb.SourceException¶
base class for source exceptions
- exception cubicweb.ConnectionError¶
raised when a bad connection id is given or when an attempt to establish a connection failed
- exception cubicweb.AuthenticationError¶
raised when an attempt to establish a connection failed due to wrong connection information (login / password or other authentication token)
- exception cubicweb.BadConnectionId¶
raised when a bad connection id is given
- exception cubicweb.UnknownEid¶
the eid is not defined in the system tables
raised when a user tries to perform an action without sufficient credentials
- exception cubicweb.QueryError¶
a query try to do something it shouldn’t
- exception cubicweb.NotAnEntity¶
raised when get_entity is called for a column which doesn’t contain a non final entity
- exception cubicweb.MultipleResultsError¶
raised when ResultSet.one() is called on a resultset with multiple rows of multiple columns.
- exception cubicweb.NoResultError¶
raised when no result is found but at least one is expected.
- exception cubicweb.UndoTransactionException(txuuid, errors)¶
Raised 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.
txuuid – Unique identifier of the partially undone transaction
errors (list) – List of errors occurred during undoing
- exception cubicweb.ConfigurationError¶
a misconfiguration error
- exception cubicweb.ExecutionError¶
server execution control error (already started, not running…)
- exception cubicweb.BadCommandUsage¶
Raised 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, msgargs=None, i18nvalues=None)¶
Validation error details the reason(s) why the validation failed.
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
- class cubicweb.Binary(buf=b'')¶
class to hold binary data. Use BytesIO to prevent use of unicode data
- class cubicweb.CubicWebEventManager¶
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)¶
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)¶
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.