Trees | Indices | Help |
|
---|
|
object --+ | meta.WithMetaMixin --+ | object --+ | | | events.WithEventsMixin --+ | object --+ | | | tales.WithAbsoluteUrlMixin --+ | object --+ | PackageElement
I am the common subclass of all package element. Package elements are unique volatile instances: * unique, because it is enforced that the same element will never be represented at a given time by two distinct instances; hence, elements can be compared with the ``is`` operator as well as ``==`` * volatile, because it is not guaranteed that, at two instants, the instance representing a given element will be the same; unused instances may be freed at any time, and a new instance will be created on demand. This should normally normally be transparent for the user. Developper note =============== So that volatility is indeed transparent to users, the `__setattr__` method has been overridden: since custom attributes are not stored in the backend, the instance should be kept in memory as long as it has custom attributes. As a consequence, all "non-custom" attributes (i.e. those that will be correctly re-generated when the element is re-instantiated) must be declared as class attribute (usually with None as their default value). This must also be true of subclasses of elements (NB: mixin classes should normally already do that).
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|||
Inherited from meta.WithMetaMixin | |||
---|---|---|---|
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from events.WithEventsMixin | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from tales.WithAbsoluteUrlMixin | |||
|
|||
|
|
|||
|
|||
|
|||
Inherited from meta.WithMetaMixin | |||
---|---|---|---|
|
|
|||
|
|
|||
_id = None
|
|||
_owner = None
|
|||
_weight = 0
|
|
|||
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 |
|||
Inherited from meta.WithMetaMixin | |||
---|---|---|---|
meta |
|
Must not be used directly, nor overridden. Use class methods instantiate or create_new instead.
|
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). |
Make instance heavier when a new custom attribute is created.
|
Make instance lighter when a custom attribute is deleted.
|
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). |
Raise a ModelError if element is not referenceable by pkg, and (if provided) if it has not the given type. Furthermore, if required is set to True, raise a ModelError if element is None (else None is silently ignored). Note that element may be a strict ID-ref, in which case this method will do its best to check its type, but will *succeed silently* if the element is unreachable (because parsers need to be able to add unreachable elements). Also, return the ID-ref of that element in this element's owner package, for this information is usually useful in the situations where a check is performed. If element is None, return "". |
Iter over all references that are made to this element. A reference is represented by a tuple of the form * ('item', list) * ('member', relation) * ('meta', package_or_element, key) * ('tagged', package, tag) * ('tagging', package, element) -- for tags only * (attribute_name, other_element) References are searched in the given package. If no package is given, references are searched in this element's owner package and in all packages that are currently loaded and directly importing this packages. |
Delete this element. If the element is known to be referenced by other elements, all remaining references are cut (but the referer elements are not deleted). Note that this does not guarantees that some references the the deleted element will not continue to exist in packages that are not currently loaded. |
The identifier of this element in the context of its owner package.
|
Rename this element to `new_id`, if it is not already in use in the package, else raises an AssertionError.
|
This cooperative method is used to update all caches when an element in the cache is renamed. The old_idref and new_idref are provided, as well as the relation (as represented by backend methods `iter_references` and `iter_references_with_import`) with this element. The renamed element may be provided or be None, depending on the situation.
|
The URI-ref identifying this element. It is built from the URI of its owner package, suffixed with the id of the element as a fragment-id (#).
|
The package containing (or owner package) this element.
|
Iter over the tags associated with this element in ``package``. If ``package`` is not set, the session variable ``package`` is used instead. If the latter is not set, a TypeError is raised. If ``inherited`` is set to False, the tags associated by imported packages of ``package`` will not be yielded. If a tag is unreachable, None is yielded. See also `iter_my_tag_ids`. |
Iter over the id-refs of the tags associated with this element in ``package``. If ``package`` is not set, the session variable ``package`` is used instead. If the latter is not set, a TypeError is raised. If ``inherited`` is set to False, the tags associated by imported packages of ``package`` will not be yielded. See also `iter_my_tags`. |
Iter over the id-refs of the tags associated with this element in ``package``. If ``package`` is not set, the session variable ``package`` is used instead. If the latter is not set, a TypeError is raised. If ``inherited`` is set to False, the tags associated by imported packages of ``package`` will not be yielded. See also `iter_my_tags`. |
Iter over all the packages associating this element to ``tag``. ``package`` is the top-level package. If not provided, the ``package`` session variable is used. If the latter is unset, a TypeError is raised. |
Is this element associated to ``tag`` by ``package``. If ``package`` is not provided, the ``package`` session variable is used. If the latter is unset, a TypeError is raised. If ``inherited`` is set to False, only return True if ``package`` itself associates this element to ``tag``; else return True also if the association is inherited from an imported package. |
Elements are created with weight 0. Increasing its weight is equivalent to creating a strong reference to it, making it not volatile. Once the reason for keeping the element is gone, the weight should be decreased again with `_decrease_weight`. |
Override WithEventsMixin.emit in order to automatically emit the package signal corresponding to each element signal.
|
Connect a handler to a signal. Note that an element with connected signals becomes heavier (i.e. less volatile). :see: `WithEventsMixin.connect`
|
Disconnect a handler from a signal. :see: `connect` :see: `WithMetaMixin.disconnect`
|
This alternative to `connect` can only be used by the element itself. It connects the handler to the signal but *does not* make the element heavier (since if the handler will disappear at the same time as the element...). |
|
Return a concise representation for the element.
|
Return the color of the element.
|
|
idThe identifier of this element in the context of its owner package. |
ownerThe package containing (or owner package) this element.
|
urirefThe URI-ref identifying this element. It is built from the URI of its owner package, suffixed with the id of the element as a fragment-id (#).
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jul 8 16:00:03 2009 | http://epydoc.sourceforge.net |