Package cubicweb :: Module appobject
[hide private]
[frames] | no frames]

Module appobject

source code


.. _appobject:

The `AppObject` class
---------------------

The AppObject class is the base class for all dynamically loaded objects
(application objects) accessible through the vregistry.

We can find a certain number of attributes and methods defined in this class and
common to all the application objects.

.. autoclass:: AppObject

Classes [hide private]
  traced_selection
Typical usage is :
  Selector
base class for selector classes providing implementation for operators &, | and ~
  MultiSelector
base class for compound selector classes
  AndSelector
and-chained selectors (formerly known as chainall)
  OrSelector
or-chained selectors (formerly known as chainfirst)
  NotSelector
negation selector
  yes
Return the score given as parameter, with a default score of 0.5 so any other selector take precedence.
  AppObject
This is the base class for CubicWeb application objects which are selected according to a context (usually at least a request and a result set).
Functions [hide private]
 
class_regid(cls)
returns a unique identifier for an appobject class
source code
 
_trace_selector(cls, selector, args, ret) source code
 
lltrace(selector)
use this decorator on your selectors so the becomes traceable with...
source code
 
objectify_selector(selector_func)
Most of the time, a simple score function is enough to build a selector.
source code
 
_instantiate_selector(selector)
ensures selector is a Selector instance
source code
Variables [hide private]
  TRACED_OIDS = None
Simple <textarea>, will return an unicode string.
Function Details [hide private]

lltrace(selector)

source code 
use this decorator on your selectors so the becomes traceable with
:class:`traced_selection`

objectify_selector(selector_func)

source code 
Most of the time, a simple score function is enough to build a selector.
The :func:`objectify_selector` decorator turn it into a proper selector
class::

    @objectify_selector
    def one(cls, req, rset=None, **kwargs):
        return 1

    class MyView(View):
        __select__ = View.__select__ & one()

_instantiate_selector(selector)

source code 

ensures selector is a Selector instance

NOTE: This should only be used locally in build___select__() XXX: then, why not do it ??