Package advene :: Package model :: Package core :: Module list :: Class List
[hide private]
[frames] | no frames]

Class List

source code

                object --+        
                         |        
        meta.WithMetaMixin --+    
                             |    
                object --+   |    
                         |   |    
    events.WithEventsMixin --+    
                             |    
                object --+   |    
                         |   |    
tales.WithAbsoluteUrlMixin --+    
                             |    
                    object --+    
                             |    
        element.PackageElement --+
                                 |
      content.WithContentMixin --+
                                 |
                    object --+   |
                             |   |
              group.GroupMixin --+
                                 |
                                List
Known Subclasses:

I expose the protocol of a basic collection, to give access to the items of a list.

I also try to efficiently cache the results I know.

Instance Methods [hide private]
 
_update_caches(self, old_idref, new_idref, element, relation)
:see-also: `advene.model.core.element.PackageElement._update_caches`
source code
 
__len__(self) source code
 
__iter__(self)
Iter over the items of this list.
source code
 
__getitem__(self, i)
Return item with index i, or raise an exception if the item is unreachable.
source code
 
__setitem__(self, i, a) source code
 
__delitem__(self, i) source code
 
_get_slice(self, s) source code
 
_set_slice(self, s, elements) source code
 
_del_slice(self, s) source code
 
insert(self, i, a) source code
 
append(self, a) source code
 
extend(self, elements) source code
 
iter_item_ids(self)
Iter over the id-refs of the items of this list.
source code
 
get_item(self, i, default=None)
Return item with index i, or default if it can not be retrieved.
source code
 
get_item_id(self, i)
Return id-ref of the item with index i.
source code

Inherited from object: __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __str__

    Inherited from element.PackageElement
 
__delattr__(self, name)
Make instance lighter when a custom attribute is deleted.
source code
 
__init__(self, owner, id)
Must not be used directly, nor overridden.
source code
 
__setattr__(self, name, value)
Make instance heavier when a new custom attribute is created.
source code
 
_compute_absolute_url(self, aliases) source code
 
_decrease_weight(self)
:see: _increase_weight
source code
 
_get_id(self)
The identifier of this element in the context of its owner package.
source code
 
_get_owner(self)
The package containing (or owner package) this element.
source code
 
_get_uriref(self)
The URI-ref identifying this element.
source code
 
_increase_weight(self)
Elements are created with weight 0.
source code
 
_iter_my_tags_or_tag_ids(self, package=None, inherited=True, _get=0)
Iter over the id-refs of the tags associated with this element in ``package``.
source code
 
_make_event_delegate(self)
Required by WithEventsMixin
source code
 
_self_connect(self, detailed_signal, handler, *args)
This alternative to `connect` can only be used by the element itself.
source code
 
_set_id(self, new_id)
Rename this element to `new_id`, if it is not already in use in the package, else raises an AssertionError.
source code
 
_tales_color(self, context)
Return the color of the element.
source code
 
_tales_my_tags(self, context_package) source code
 
_tales_representation(self, context)
Return a concise representation for the element.
source code
 
connect(self, detailed_signal, handler, *args)
Connect a handler to a signal.
source code
 
delete(self)
Delete this element.
source code
 
disconnect(self, handler_id)
Disconnect a handler from a signal.
source code
 
emit(self, detailed_signal, *args)
Override WithEventsMixin.emit in order to automatically emit the package signal corresponding to each element signal.
source code
 
has_tag(self, tag, package=None, inherited=True)
Is this element associated to ``tag`` by ``package``.
source code
 
iter_my_tag_ids(self, package=None, inherited=True, _get=0)
Iter over the id-refs of the tags associated with this element in ``package``.
source code
 
iter_my_tags(self, package=None, inherited=True)
Iter over the tags associated with this element in ``package``.
source code
 
iter_references(self, package=None)
Iter over all references that are made to this element.
source code
 
iter_taggers(self, tag, package=None)
Iter over all the packages associating this element to ``tag``.
source code
 
make_id_in(self, pkg)
Compute an id-ref for this element in the context of the given package.
source code
    Inherited from meta.WithMetaMixin
 
_get_meta_id_or_ref(self, key, default=_RAISE, _return_id=True)
Return the metadata id (string or element) associated to the given key.
source code
 
_get_ns_dict(self) source code
 
_tales_meta(self, context=None) source code
 
del_meta(self, key)
Delete the metadata.
source code
 
get_meta(self, key, default=_RAISE)
Return the metadata (string or element) associated to the given key.
source code
 
get_meta_id(self, key, default=_RAISE, _return_id=True)
Return the metadata id (string or element) associated to the given key.
source code
 
iter_meta(self)
Iter over all the metadata of this object.
source code
 
iter_meta_ids(self)
Iter over all the metadata of this object.
source code
 
set_meta(self, key, val, val_is_idref=False)
Set the metadata.
source code
    Inherited from events.WithEventsMixin
 
block_handler(self, handler_id)
Prevent the handler identified by handler_id to be invoked until it is unblocked.
source code
 
emit_lazy(self, lazy_params)
Like emit, but lazy_params is assumed to be a function returning an iterable of the params to send to emit.
source code
 
enter_no_event_section(self)
Disable all event emission for this object, until `exit_no_event_section` is called.
source code
 
exit_no_event_section(self)
Re-enables all event emission for this object.
source code
 
handler_block(self, handler_id)
Prevent the handler identified by handler_id to be invoked until it is unblocked.
source code
 
handler_is_connected(self, handler_id)
Return True iff the given handler_id represents a connected handler.
source code
 
handler_unblock(self, handler_id)
Unblock the blocked handler identified by handler_id so it can be invoked again.
source code
 
has_handler(self, handler_id)
Return True iff the given handler_id represents a connected handler.
source code
 
stop_emission(self, detailed_signal)
Stop the current emission of the signal specified by detailed_signal.
source code
 
unblock_handler(self, handler_id)
Unblock the blocked handler identified by handler_id so it can be invoked again.
source code
    Inherited from tales.WithAbsoluteUrlMixin
 
_absolute_url_fail(self, msg='') source code
 
_tales_absolute_url(self, context)
See class documentation.
source code
    Inherited from content.WithContentMixin
 
_check_content(self, mimetype=None, model_id=None, url=None)
Check that the provided values (assumed to be the future values of the corresponding attributes) are valid and consistent (with each other *and* with unmodified attributes).
source code
 
_get_content(self)
Return a `Content` instance representing the content.
source code
 
_get_content_as_file(self)
This property returns a *copy* of this element's content data wrapped in a file-like object.
source code
 
_get_content_data(self)
This property holds the data of the content.
source code
 
_get_content_is_textual(self)
This property indicates if this element's content data can be handled as text.
source code
 
_get_content_mimetype(self)
The mimetype of this element's content.
source code
 
_get_content_model(self)
The resource used as the model of the content of this element.
source code
 
_get_content_model_id(self)
The id-ref of the content model, or an empty string.
source code
 
_get_content_parsed(self) source code
 
_get_content_url(self)
This property holds the URL of the content, or an empty string.
source code
 
_instantiate_content(self, mimetype, model, url)
This is method is for optimization only: it is not strictly required (though recommended) to call it at instantiate time (see class docstring).
source code
 
_load_content_info(self)
Load the content info (mimetype, model, url).
source code
 
_set_content_data(self, data)
See `_get_content_data`.
source code
 
_set_content_mimetype(self, mimetype) source code
 
_set_content_model(self, resource)
FIXME: missing docstring.
source code
 
_set_content_parsed(self, parsed) source code
 
_set_content_url(self, url)
See `_get_content_url`.
source code
 
_update_content_handler(self)
See :class:`WithContentMixin` documentation.
source code
 
get_content_as_synced_file(self)
Return a file-like object giving access to the content data.
source code
 
get_content_model(self, default=None)
Return the resource used as the model of the content of this element.
source code
    Inherited from group.GroupMixin
 
count_annotations(self) source code
 
count_imports(self) source code
 
count_lists(self) source code
 
count_medias(self) source code
 
count_queries(self) source code
 
count_relations(self) source code
 
count_resources(self) source code
 
count_tags(self) source code
 
count_views(self) source code
 
iter_annotations(self) source code
 
iter_imports(self) source code
 
iter_lists(self) source code
 
iter_medias(self) source code
 
iter_queries(self) source code
 
iter_relations(self) source code
 
iter_resources(self) source code
 
iter_tags(self) source code
 
iter_views(self) source code
Class Methods [hide private]
 
instantiate(cls, owner, id, *args)
Factory method to create an instance from backend data.
source code
 
create_new(cls, owner, id, items=())
Factory method to create a new instance both in memory and backend.
source code
    Inherited from meta.WithMetaMixin
 
make_metadata_property(cls, key, alias=None, default=_RAISE, doc=None)
Attempts to create a python property in cls mapping to metadata key.
source code
    Inherited from content.WithContentMixin
 
_check_content_cls(cls, mimetype, model, url, _func=<function _check_content at 0x8f0125c>)
This is a classmethod variant of _check_content, to be use in _instantiate (note that all parameters must be provided in this variant).
source code
Static Methods [hide private]
    Inherited from element.PackageElement
 
_check_reference(pkg, element, type=None, required=False)
Raise a ModelError if element is not referenceable by pkg, and (if provided) if it has not the given type.
source code
Class Variables [hide private]
  ADVENE_TYPE = 'l'
  _cache = None
  _ids = None
    Inherited from element.PackageElement
  _id = None
  _owner = None
  _weight = 0
Properties [hide private]

Inherited from object: __class__

    Inherited from element.PackageElement
  id
The identifier of this element in the context of its owner package.
  owner
The package containing (or owner package) this element.
  uriref
The URI-ref identifying this element.
    Inherited from meta.WithMetaMixin
  meta
    Inherited from content.WithContentMixin
  content
Return a `Content` instance representing the content.
  content_as_file
This property returns a *copy* of this element's content data wrapped in a file-like object.
  content_data
This property holds the data of the content.
  content_is_textual
This property indicates if this element's content data can be handled as text.
  content_mimetype
The mimetype of this element's content.
  content_model
The resource used as the model of the content of this element.
  content_model_id
The id-ref of the content model, or an empty string.
  content_parsed
  content_url
This property holds the URL of the content, or an empty string.
    Inherited from group.GroupMixin
  annotations
  imports
  lists
  medias
  queries
  relations
  resources
  tags
  views
Method Details [hide private]

instantiate(cls, owner, id, *args)
Class Method

source code 

Factory method to create an instance from backend data.

This method expect the exact data from the backend, so it does not need to be tolerant or to check consistency (the backend is assumed to be sane).

Overrides: element.PackageElement.instantiate
(inherited documentation)

create_new(cls, owner, id, items=())
Class Method

source code 

Factory method to create a new instance both in memory and backend.

This method will usually perform checks and conversions from its actual arguments to the data expected to the backend. It is responsible for 1/ storing the data in the backend and 2/ initializing the instance (for which it should reuse instantiate to reduce redundancy).

Note that this method *should* be tolerant w.r.t. its parameters, especially accepting both element instances or ID-refs.

NB: this method does nothing and must not be invoked by superclasses (indeed, it raises an exception).

Overrides: element.PackageElement.create_new
(inherited documentation)

_update_caches(self, old_idref, new_idref, element, relation)

source code 

:see-also: `advene.model.core.element.PackageElement._update_caches`

Overrides: content.WithContentMixin._update_caches

__iter__(self)

source code 

Iter over the items of this list.

If the list contains unreachable items, None is yielded instead.

See also `iter_item_ids`.

Overrides: group.GroupMixin.__iter__

__getitem__(self, i)
(Indexing operator)

source code 

Return item with index i, or raise an exception if the item is unreachable.

See also `get_item` and `get_item_id`.

iter_item_ids(self)

source code 

Iter over the id-refs of the items of this list.

See also `__iter__`.

get_item(self, i, default=None)

source code 

Return item with index i, or default if it can not be retrieved.

Note that if ``i`` is an invalid index, an IndexError will still be raised.

See also `__getitem__` and `get_item_id`.

get_item_id(self, i)

source code 

Return id-ref of the item with index i.

See also `__getitem__` and `get_item`.