update exemples using the 3.6 api and add/fix some sections (schema, vreg, talk about CW_MODE in concepts...). So much to do :'(
--- a/doc/book/en/admin/gae.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/admin/gae.rst Wed Feb 03 18:44:24 2010 +0100
@@ -132,7 +132,7 @@
Otherwise, please skip it.
You will never need to add new entries in the translation catalog. Instead we
-would recommand you to use ``self.req._("msgId")`` in your code to flag new
+would recommand you to use ``self._cw._("msgId")`` in your code to flag new
message id to add to the catalog, where ``_`` refers to xgettext that is used to
collect new strings to translate. While running ``laxctl i18ncube``, new string
will be added to the catalogs.
@@ -168,13 +168,13 @@
# does this instance rely on google authentication service or not.
use-google-auth=no
-In ``app.yaml`` comment the `login: required` set by default in the handler::
+In ``app.yaml`` comment the `login:._cwuired` set by default in the handler::
- url: .*
script: main.py
# comment the line below to allow anonymous access or if you don't want to use
# google authentication service
- #login: required
+ #login:._cwuired
@@ -208,7 +208,7 @@
and administrator login but you will get the cookie value as well.
This cookie values needs to be provided to ``laxctl`` commands
-in order to handle datastore administration requests.
+in order to handle datastore administration._cwuests.
.. image:: ../images/lax-book.02-cookie-values.en.png
:alt: displaying the detailed view of the cookie values returned
--- a/doc/book/en/admin/index.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/admin/index.rst Wed Feb 03 18:44:24 2010 +0100
@@ -20,7 +20,7 @@
multisources
ldap
gae
- addition-tips
+ additional-tips
RQL logs
--------
--- a/doc/book/en/annexes/rql/implementation.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/annexes/rql/implementation.rst Wed Feb 03 18:44:24 2010 +0100
@@ -142,7 +142,7 @@
- missing proper explicit type conversion, COALESCE and certainly other things...
-- writing a rql query require knowledge of the schema used (with real relation
+- writing a rql query._cwuire knowledge of the schema used (with real relation
names and entities, not those viewing in the user interface). On the other
hand, we can not really bypass that, and it is the job of a user interface to
hide the RQL.
--- a/doc/book/en/conf.py Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/conf.py Wed Feb 03 18:44:24 2010 +0100
@@ -19,6 +19,7 @@
# serve to show the default value.
import sys, os
+from cubicweb import __pkginfo__ as cw
# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
@@ -42,16 +43,16 @@
master_doc = 'index'
# General substitutions.
-project = 'Cubicweb'
+project = 'CubicWeb'
copyright = '2008-2010, Logilab'
# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
# The short X.Y version.
-version = '3.5'
+version = '.'.join(str(n) for n in cw.numversion[:2])
# The full version, including alpha/beta/rc tags.
-release = '3.5'
+release = cw.version
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
--- a/doc/book/en/development/cubes/cc-newcube.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/cubes/cc-newcube.rst Wed Feb 03 18:44:24 2010 +0100
@@ -4,17 +4,16 @@
Let's start by creating the cube environment in which we will develop ::
cd ~/hg
-
- cubicweb-ctl newcube mycube
-
- # answer questions
- hg init moncube
+ # use cubicweb-ctl to generate a template for the cube
+ cubicweb-ctl newcube mycube # will ask some questions, most with nice default
+ # makes the cube source code managed by mercurial
cd mycube
+ hg init
hg add .
hg ci
If all went well, you should see the cube you just created in the list
-returned by ``cubicweb-ctl list`` in the section *Available components*,
+returned by ``cubicweb-ctl list`` in the section *Available cubes*,
and if it is not the case please refer to :ref:`ConfigurationEnv`.
To reuse an existing cube, add it to the list named ``__use__`` and defined in
@@ -24,22 +23,26 @@
work otherwise).
.. note::
- Please note that if you do not wish to use default directory
- for your cubes library, then you want to use the option
- --directory to specify where you would like to place
- the source code of your cube:
- ``cubicweb-ctl newcube --directory=/path/to/cubes/library cube_name``
+
+ Please note that if you do not wish to use default directory for your cubes
+ library, you should set the :envvar:`CW_CUBES_PATH` environment variable to
+ add extra directories where cubes will be search, and you'll then have to use
+ the option `--directory` to specify where you would like to place the source
+ code of your cube:
+
+ ``cubicweb-ctl newcube --directory=/path/to/cubes/library mycube``
-Usage of :command:`cubicweb-ctl liveserver`
--------------------------------------------
+.. XXX resurrect once live-server is back
+.. Usage of :command:`cubicweb-ctl liveserver`
+.. -------------------------------------------
-To quickly test a new cube, you can also use the `liveserver` command for cubicweb-ctl
-which allows to create an instance in memory (using an SQLite database by
-default) and make it accessible through a web server ::
+.. To quickly test a new cube, you can also use the `liveserver` command for cubicweb-ctl
+.. which allows to create an instance in memory (using an SQLite database by
+.. default) and make it accessible through a web server ::
- cubicweb-ctl live-server mycube
+.. cubicweb-ctl live-server mycube
-or by using an existing database (SQLite or Postgres)::
+.. or by using an existing database (SQLite or Postgres)::
- cubicweb-ctl live-server -s myfile_sources mycube
+.. cubicweb-ctl live-server -s myfile_sources mycube
--- a/doc/book/en/development/cubes/layout.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/cubes/layout.rst Wed Feb 03 18:44:24 2010 +0100
@@ -79,7 +79,7 @@
* ``schema`` contains the schema definition (server side only)
* ``entities`` contains the entities definition (server side and web interface)
-* ``sobjects`` contains hooks and/or views notifications (server side only)
+* ``hooks`` contains hooks and/or views notifications (server side only)
* ``views`` contains the web interface components (web interface only)
* ``test`` contains tests related to the cube (not installed)
* ``i18n`` contains message catalogs for supported languages (server side and
--- a/doc/book/en/development/datamodel/baseschema.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/datamodel/baseschema.rst Wed Feb 03 18:44:24 2010 +0100
@@ -1,38 +1,43 @@
+.. _CWBaseEntityTypes:
Pre-defined entities in the library
-----------------------------------
-The library defines a set of entity schemas that are required by the system
+The library defines a set of entity schemas that are._cwuired by the system
or commonly used in *CubicWeb* instances.
Entity types used to store the schema
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* `CWEType`, entity type
-* `CWRType`, relation type
-* `CWRelation`, relation definition
-* `CWAttribute`, attribute relation definition
-* `CWConstraint`, `CWConstraintType`, `RQLExpression`
+* _`CWEType`, entity type
+* _`CWRType`, relation type
+* _`CWRelation`, relation definition
+* _`CWAttribute`, attribute relation definition
+* _`CWConstraint`, `CWConstraintType`, `RQLExpression`
Entity types used to manage users and permissions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* `CWUser`, system users
-* `CWGroup`, users groups
-* `CWPermission`, used to configure the security of the instance
+* _`CWUser`, system users
+* _`CWGroup`, users groups
+* _`CWPermission`, used to configure the security of the instance
Entity types used to manage workflows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-* `State`, workflow state
-* `Transition`, workflow transition
-* `TrInfo`, record of a transition trafic for an entity
+* _`Workflow`, workflow entity, linked to some entity types which may use this workflow
+* _`State`, workflow state
+* _`Transition`, workflow transition
+* _`TrInfo`, record of a transition trafic for an entity
Other entity types
~~~~~~~~~~~~~~~~~~
-* `CWCache`, cache entities used to improve performances
-* `CWProperty`, used to configure the instance
+* _`CWCache`, cache entities used to improve performances
+* _`CWProperty`, used to configure the instance
-* `EmailAddress`, email address, used by the system to send notifications
+* _`EmailAddress`, email address, used by the system to send notifications
to the users and also used by others optionnals schemas
-* `Bookmark`, an entity type used to allow a user to customize his links within
+* _`Bookmark`, an entity type used to allow a user to customize his links within
the instance
+
+* _`ExternalUri`, used for semantic web site to indicate that an entity is the
+ same as another from an external site
--- a/doc/book/en/development/datamodel/define-workflows.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/datamodel/define-workflows.rst Wed Feb 03 18:44:24 2010 +0100
@@ -122,9 +122,8 @@
If we use an RQL condition on a transition, we can use the following variables:
-* `%(eid)s`, object's eid
-* `%(ueid)s`, user executing the query eid
-* `%(seid)s`, the object's current state eid
+* `X`, the entity on which we may pass the transition
+* `U`, the user executing that may pass the transition
.. image:: ../../images/03-transitions-view.en.png
--- a/doc/book/en/development/datamodel/definition.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/datamodel/definition.rst Wed Feb 03 18:44:24 2010 +0100
@@ -5,66 +5,73 @@
The **schema** is the core piece of a *CubicWeb* instance as it defines
the handled data model. It is based on entity types that are either already
-defined in the *CubicWeb* standard library; or more specific types, that
-*CubicWeb* expects to find in one or more Python files under the directory
-`schema`.
+defined in the *CubicWeb* standard library; or more specific types defined
+in cubes. The schema for a cube is defined in a :file:schema.py file or in
+one or more Python files under the :file:`schema` directory (python package).
At this point, it is important to make clear the difference between
*relation type* and *relation definition*: a *relation type* is only a relation
-name with potentially other additionnal properties (see XXXX), whereas a
+name with potentially other additionnal properties (see below), whereas a
*relation definition* is a complete triplet
"<subject entity type> <relation type> <object entity type>".
A relation type could have been implied if none is related to a
relation definition of the schema.
+Also, it should be clear that to properly handle data migration, an instance'schema
+is stored in the database, so the python schema file used to defined it are only readen
+when the instance is created or upgraded.
-All *CubicWeb* built-in types are available : `String`, `Int`, `Float`,
+The following built-in types are available : `String`, `Int`, `Float`,
`Decimal`, `Boolean`, `Date`, `Datetime`, `Time`, `Interval`, `Byte`
and `Password`.
-They are implicitely imported (as well as the special the function "_"
-for translation :ref:`internationalization`).
+
+You'll also have access to :ref:`CWBaseEntityTypes_:base cubicweb entitye types`.
-The instance schema is defined on all appobjects by a .schema class attribute set
-on registration. It's an instance of :class:`yams.schema.Schema`.
+The instance schema is accessible through the .schema attribute of the
+`vregistry`. It's an instance of :class:`cubicweb.schema.Schema`, which
+extends :class:`yams.schema.Schema`.
+
+:note:
+ In previous yams versions, almost all classes where available without
+ any import, but the should now be explicitely imported.
+
Entity type
~~~~~~~~~~~
-It's an instance of :class:`yams.schema.EntitySchema`
+It's an instance of :class:`yams.schema.EntitySchema`. Each entity types has
+a set of attributes and relation and some permissions, defining who can add, read,
+update or delete entities of this type.
-XXX meta
-XXX permission
XXX yams inheritance
Relation type
~~~~~~~~~~~~~
-It's an instance of :class:`yams.schema.RelationSchema`
+It's an instance of :class:`yams.schema.RelationSchema`. A relation type is simply
+a semantic definition of a kind of relationship that may occurs in your application.
-In addition to the permissions, the properties of the relation types
-(shared also by all definition of relation of this type) are :
+It's important to choose a good name, at least to avoid conflicts with some semantically
+different relation defined in other cubes (since we've no namespace yet).
+A relation type hold the following properties (which are hence shared between all
+relation definitions of that type):
* `inlined` : boolean handling the physical optimization for archiving
the relation in the subject entity table, instead of creating a specific
- table for the relation. This applies to the relation when the cardinality
- of subject->relation->object is 0..1 (`?`) or 1..1 (`1`)
+ table for the relation. This applies to relations where cardinality
+ of subject->relation->object is 0..1 (`?`) or 1..1 (`1`) for *all* its relation
+ definitions.
* `symmetric` : boolean indicating that the relation is symmetrical, which
- means `X relation Y` implies `Y relation X`
-
-XXX meta
-XXX permission
+ means that `X relation Y` implies `Y relation X`.
Relation definition
~~~~~~~~~~~~~~~~~~~
-Relation definition are represented in yams using an internal structure only exposed through the :mod:`api <yams.schema>`.
+It's an instance of :class:`yams.schema.RelationDefinition`. It is a complete triplet
+"<subject entity type> <relation type> <object entity type>".
Properties
``````````
-Properties defined below are accessible through the following api:
-
- RelationSchema.rproperties()
- RelationSchema.rproperty(subjtype, objtype, property name)
* Optional properties for attributes and relations :
@@ -88,13 +95,8 @@
* `+`: 1..n
* `*`: 0..n
- - `meta` : boolean indicating that the relation is a meta-relation (false by
- default, will disappear in *CubicWeb* 3.5)
-
* optional properties for attributes :
- - `required` : boolean indicating if the attribute is required (false by default)
-
- `unique` : boolean indicating if the value of the attribute has to be unique
or not within all entities of the same type (false by default)
@@ -106,8 +108,6 @@
- `default` : default value of the attribute. In case of date types, the values
which could be used correspond to the RQL keywords `TODAY` and `NOW`.
- - `vocabulary` : specify static possible values of an attribute
-
* optional properties of type `String` :
- `fulltextindexed` : boolean indicating if the attribute is part of
@@ -117,15 +117,13 @@
- `internationalizable` : boolean indicating if the value of the attribute
is internationalizable (false by default)
- - `maxsize` : integer providing the maximum size of the string (no limit by default)
-
* optional properties for relations :
- `composite` : string indicating that the subject (composite == 'subject')
is composed of the objects of the relations. For the opposite case (when
the object is composed of the subjects of the relation), we just set
'object' as value. The composition implies that when the relation
- is deleted (so when the composite is deleted), the composed are also deleted.
+ is deleted (so when the composite is deleted, at least), the composed are also deleted.
- `fti_container`: XXX feed me
@@ -147,6 +145,8 @@
* `StaticVocabularyConstraint` : identical to "vocabulary=(...)"
+XXX Attribute, TODAY, NOW
+
RQL Based Constraints
......................
@@ -239,7 +239,7 @@
actions if all the other groups the user belongs does not provide
those permissions
-Setting permissions is done with the attribute `permissions` of entities and
+Setting permissions is done with the attribute `__permissions__` of entities and
relation types. It defines a dictionary where the keys are the access types
(action), and the values are the authorized groups or expressions.
@@ -283,7 +283,7 @@
* in this expression, the variables X and U are pre-defined references
respectively on the current entity (on which the action is verified) and
- on the user who send the request
+ on the user who send the._cwuest
* it is possible to use, in this expression, a special relation
"has_<ACTION>_permission" where the subject is the user and the
@@ -348,15 +348,24 @@
The class name corresponds to the entity type name. It is exepected to be
defined in the module ``mycube.schema``.
+When defining a schema using python files, you may use the following shortcuts:
-For example ::
+- ._cwuired` : boolean indicating if the attribute is._cwuired, eg subject cardinality is '1'
+
+- `vocabulary` : specify static possible values of an attribute
+
+- `maxsize` : integer providing the maximum size of a string (no limit by default)
+
+For example:
+
+.. sourcecode:: python
class Person(EntityType):
"""A person with the properties and the relations necessary for my
application"""
- last_name = String(required=True, fulltextindexed=True)
- first_name = String(required=True, fulltextindexed=True)
+ last_name = String._cwuired=True, fulltextindexed=True)
+ first_name = String._cwuired=True, fulltextindexed=True)
title = String(vocabulary=('Mr', 'Mrs', 'Miss'))
date_of_birth = Date()
works_for = SubjectRelation('Company', cardinality='?*')
@@ -429,7 +438,7 @@
can both be equal to the value of the first argument of `SubjectRelation`
and `ObjectRelation`.
-When a relation is not inlined and not symmetrical, and it does not require
+When a relation is not inlined and not symmetrical, and it does not._cwuire
specific permissions, its definition (by using `SubjectRelation` and
`ObjectRelation`) is all we need.
@@ -439,24 +448,28 @@
In addition to that the entity type `CWPermission` from the standard library
allow to build very complex and dynamic security architecture. The schema of
-this entity type is as follow : ::
+this entity type is as follow:
- class CWPermission(MetaEntityType):
+.. sourcecode:: python
+
+ class CWPermission(EntityType):
"""entity type that may be used to construct some advanced security configuration
"""
- name = String(required=True, indexed=True, internationalizable=True, maxsize=100)
- require_group = SubjectRelation('CWGroup', cardinality='+*',
+ name = String._cwuired=True, indexed=True, internationalizable=True, maxsize=100)
+._cwuire_group = SubjectRelation('CWGroup', cardinality='+*',
description=_('groups to which the permission is granted'))
- require_state = SubjectRelation('State',
+._cwuire_state = SubjectRelation('State',
description=_("entity's state in which the permission is applicable"))
# can be used on any entity
- require_permission = ObjectRelation('**', cardinality='*1', composite='subject',
+._cwuire_permission = ObjectRelation('**', cardinality='*1', composite='subject',
description=_("link a permission to the entity. This "
"permission should be used in the security "
"definition of the entity's type to be useful."))
-Example of configuration ::
+Example of configuration:
+
+.. sourcecode:: python
...
@@ -464,24 +477,23 @@
class Version(EntityType):
"""a version is defining the content of a particular project's release"""
- permissions = {'read': ('managers', 'users', 'guests',),
+ __permissions__ = {'read': ('managers', 'users', 'guests',),
'update': ('managers', 'logilab', 'owners',),
'delete': ('managers', ),
'add': ('managers', 'logilab',
ERQLExpression('X version_of PROJ, U in_group G,'
- 'PROJ require_permission P, P name "add_version",'
- 'P require_group G'),)}
+ 'PROJ._cwuire_permission P, P name "add_version",'
+ 'P._cwuire_group G'),)}
- ...
class version_of(RelationType):
"""link a version to its project. A version is necessarily linked to one and only one project.
"""
- permissions = {'read': ('managers', 'users', 'guests',),
+ __permissions__ = {'read': ('managers', 'users', 'guests',),
'delete': ('managers', ),
'add': ('managers', 'logilab',
- RRQLExpression('O require_permission P, P name "add_version",'
- 'U in_group G, P require_group G'),)
+ RRQLExpression('O._cwuire_permission P, P name "add_version",'
+ 'U in_group G, P._cwuire_group G'),)
}
inlined = True
@@ -494,4 +506,4 @@
* because of the genericity of the entity type `CWPermission`, we have to execute
a unification with the groups and/or the states if necessary in the expression
- ("U in_group G, P require_group G" in the above example)
+ ("U in_group G, P._cwuire_group G" in the above example)
--- a/doc/book/en/development/datamodel/index.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/datamodel/index.rst Wed Feb 03 18:44:24 2010 +0100
@@ -10,4 +10,3 @@
metadata
baseschema
define-workflows
- inheritance
--- a/doc/book/en/development/datamodel/inheritance.rst Wed Feb 03 14:46:32 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-
-Inheritance
------------
-
-When describing a data model, entities can inherit from other entities as is
-common in object-oriented programming.
-
-You have the possibility to adapt some entity attributes, as follow:
-
-.. sourcecode:: python
-
- from cubes.OTHER_CUBE import entities
- class EntityExample(entities.EntityExample):
- def dc_long_title(self):
- return '%s (%s)' % (self.name, self.description)
-
-
-XXX WRITME
--- a/doc/book/en/development/datamodel/metadata.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/datamodel/metadata.rst Wed Feb 03 18:44:24 2010 +0100
@@ -1,43 +1,54 @@
Meta-data
-----------
+---------
-Each entity type has at least the following meta-relations:
+.. index::
+ schema: meta-data;
+ schema: eid; creation_date; modification_data; cwuri
+ schema: created_by; owned_by; is; is_instance;
+
+Each entity type in |cubicweb| has at least the following meta-data attributes and relations:
eid
-~~~
-Each entity in *CubicWeb* has an associated identifier which is unique
-in an instance. We usually call this identifier `eid`.
+ entity's identifier which is unique in an instance. We usually call this identifier `eid` for historical reason.
+
+creation_date
+ Date and time of the creation of the entity.
+
+modification_date
+ Date and time of the latest modification of an entity.
+
+cwuri
+ Reference URL of the entity, which is not expected to change.
-`creation_date` and `modification_date`
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Date and time of the creation / lastest modification of an entity.
+created_by
+ Relation to the :ref:`users <CWUser>` who has created the entity
+
+owned_by
+ Relation to :ref:`users <CWUser>` whom the entity belongs; usually the creator but not
+ necessary, and it could have multiple owners notably for permission control
+
+is
+ Relation to the :ref:`entity type <CWEType>` of which type the entity is.
+
+is_instance
+ Relation to the :ref:`entity types <CWEType>` of which type the
+ entity is an instance of.
-`created_by`
-~~~~~~~~~~~~
-relation to the :ref:`users <CWUser>` who has created the entity
+Virtual RQL relations
+---------------------
+XXX move this to the RQL chapter.
+
+Those relations may only be used in RQL query and are not actual attributes of your entities...
-`owned_by`
-~~~~~~~~~~
-relation to :ref:`users <CWUser>` whom the entity belongs; usually the creator but not
-necessary, and it could have multiple owners notably for permission control
+has_text
+ Relation to use to query the full text index (only for entities having fulltextindexed attributes).
-`is`
-~~~~~
-relation to the :ref:`entity type <CWEType>` of which type the entity is.
-
-`is_instance`
-~~~~~~~~~~~~~
-relation to the :ref:`entity types <CWEType>` of which type the entity is an instance of.
+identity
+ Relation to use to tell that a RQL variable should be the same as entity another
+(but you've to use two different rql variables for querying purpose)
-Special relations
------------------
-`has_text`
-~~~~~~~~~~
-query the full text index (only for entities having fulltextindexed attributes)
-`identity`
-~~~~~~~~~~
-XXX
\ No newline at end of file
+.. |cubicweb| replace:: *CubicWeb*
\ No newline at end of file
--- a/doc/book/en/development/devcore/appobject.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devcore/appobject.rst Wed Feb 03 18:44:24 2010 +0100
@@ -25,7 +25,7 @@
We also find on instances, the following attributes:
-* `req`, `Request` instance
+* ._cw`, `Request` instance
* `rset`, the *result set* associated to the object if necessary
:URL handling:
--- a/doc/book/en/development/devcore/selectors.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devcore/selectors.rst Wed Feb 03 18:44:24 2010 +0100
@@ -2,7 +2,7 @@
--------------
Selectors are scoring functions that are called by the view dispatcher to tell
-whenever a view can be applied to a given result set of a request. Selector sets
+whenever a view can be applied to a given result set of a._cwuest. Selector sets
are the glue that tie views to the data model. Using them appropriately is an
essential part of the construction of well behaved cubes.
--- a/doc/book/en/development/devcore/vreg.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devcore/vreg.rst Wed Feb 03 18:44:24 2010 +0100
@@ -1,5 +1,3 @@
-. -*- coding: utf-8 -*-
-
The VRegistry
--------------
@@ -9,21 +7,41 @@
Details of the recording process
````````````````````````````````
-XXX this part needs to be updated and checked
+.. index::
+ vregistry: registration_callback
+
+On startup, |cubicweb| have to fill the vregistry with appobjects defined
+in its library and in cubes used by the instance. Appobjects from the library
+are loaded first, then appobjects provided by cubes are loaded in an ordered
+way (e.g. if your cube depends on an other, appobjects from the dependancy will
+be loaded first). Cube's modules or packages where appobject are looked at is explained
+in :ref:`cubelayout`.
+
+For each module:
* by default all objects are registered automatically
* if some objects have to replace other objects or be included only if a
- condition is true,
- - explicitly register the object by defining `registration_callback(vreg)`
- - call registration methods on objects listed in the vreg registry
+ condition is true, you'll have to define a `registration_callback(vreg)`
+ function in your module and explicitly register *all objects* in this
+ module, using the vregistry api defined below.
.. note::
Once the function `registration_callback(vreg)` is implemented, all the objects
have to be explicitly registered as it disables the automatic object registering.
-Examples:
+API d'enregistrement des objets
+```````````````````````````````
+.. automethod:: cubicweb.cwvreg.CubicWebVRegistry.register_all
+.. automethod:: cubicweb.cwvreg.CubicWebVRegistry.register_and_replace
+.. automethod:: cubicweb.cwvreg.CubicWebVRegistry.register
+.. automethod:: cubicweb.cwvreg.CubicWebVRegistry.register_if_interface_found
+.. automethod:: cubicweb.cwvreg.CubicWebVRegistry.unregister
+
+
+Examples
+````````
.. sourcecode:: python
# web/views/basecomponents.py
@@ -37,31 +55,17 @@
# goa/appobjects/sessions.py
def registration_callback(vreg):
vreg.register(SessionsCleaner)
- vreg.register(GAEAuthenticationManager, clear=True)
- vreg.register(GAEPersistentSessionManager, clear=True)
-
-
-API d'enregistrement des objets
-```````````````````````````````
-
-.. sourcecode:: python
-
- register(obj, registryname=None, oid=None, clear=False)
-
- register_all(objects, modname, butclasses=())
-
- unregister(obj, registryname=None)
-
- register_and_replace(obj, replaced, registryname=None)
-
- register_if_interface_found(obj, ifaces, **kwargs)
+ # replace AuthenticationManager by GAEAuthenticationManager
+ vreg.register_and_replace(GAEAuthenticationManager, AuthenticationManager)
+ # replace PersistentSessionManager by GAEPersistentSessionManager
+ vreg.register_and_replace(GAEPersistentSessionManager, PersistentSessionManager)
Runtime objects selection
~~~~~~~~~~~~~~~~~~~~~~~~~
-Defining selectors
-``````````````````
+Using and combining existant selectors
+``````````````````````````````````````
The object's selector is defined by its `__select__` class attribute.
@@ -75,7 +79,7 @@
Of course you can use paren to balance expressions.
-For instance, if you are selecting the primary (eg `id = 'primary'`) view (eg
+For instance, if you are selecting the primary (eg `__regid__ = 'primary'`) view (eg
`__registry__ = 'view'`) for a result set containing a `Card` entity, 2 objects
will probably be selectable:
@@ -148,10 +152,20 @@
* redefine this method on Blog.
When to use selectors?
-```````````````````````
+``````````````````````
+
+Selectors are to be used whenever arises the need of dispatching on the shape or
+content of a result set or whatever else context (value in._cwuest form params,
+authenticated user groups, etc...). That is, almost all the time.
-Selectors are to be used whenever arises the need of dispatching on
-the shape or content of a result set. That is, almost all the time.
+XXX add and example of a single view w/ big "if" inside splitted into two views
+with appropriate selectors.
+
+
+Defining your own selectors
+```````````````````````````
+XXX objectify_selector, EntitySelector, EClassSelector...
+
Debugging
`````````
@@ -165,22 +179,17 @@
.. sourcecode:: python
- def possible_objects(self, registry, *args, **kwargs):
- """return an iterator on possible objects in a registry for this result set
-
- actions returned are classes, not instances
- """
- from cubicweb.selectors import traced_selection
- with traced_selection():
- for vobjects in self.registry(registry).values():
- try:
- yield self.select(vobjects, *args, **kwargs)
- except NoSelectableObject:
- continue
+ from cubicweb.selectors import traced_selection
+ with traced_selection():
+ mycomp = self._cw.vreg['views'].select('wfhistory', self._cw, rset=rset)
Don't forget the 'from __future__ import with_statement' at the module
-top-level.
+top-level if you're using python 2.5.
This will yield additional WARNINGs in the logs, like this::
2009-01-09 16:43:52 - (cubicweb.selectors) WARNING: selector one_line_rset returned 0 for <class 'cubicweb.web.views.basecomponents.WFHistoryVComponent'>
+
+
+
+Take care not filtering-out messages whose log level is <= LOG_WARNING!
\ No newline at end of file
--- a/doc/book/en/development/devweb/css.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devweb/css.rst Wed Feb 03 18:44:24 2010 +0100
@@ -7,7 +7,7 @@
XXX external_resources variable
naming convention
- request.add_css
+ ._cwuest.add_css
Extending / overriding existing styles
--- a/doc/book/en/development/devweb/facets.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devweb/facets.rst Wed Feb 03 18:44:24 2010 +0100
@@ -111,7 +111,7 @@
class CompositionDateFacet(DateRangeFacet):
# 1. make sure this facet is displayed only on Track selection
__select__ = DateRangeFacet.__select__ & implements('Track')
- # 2. give the facet an id (required by CubicWeb)
+ # 2. give the facet an id ._cwuired by CubicWeb)
id = 'compdate-facet'
# 3. specify the attribute name that actually stores the date in the DB
rtype = 'composition_date'
--- a/doc/book/en/development/devweb/gettingdata.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devweb/gettingdata.rst Wed Feb 03 18:44:24 2010 +0100
@@ -6,7 +6,7 @@
You might have spotted this in the explanations about the views, to
get data, when not using a toplevel method, you will execute an RQL
-query over the request. For more details about RQL, head out to the
+query over the._cwuest. For more details about RQL, head out to the
`RQL chapter`
Basic cases
@@ -15,7 +15,7 @@
from the RQL backend, you will execute an RQL command and obtain a
resultset ::
- rset = self.req.execute(rql_command)
+ rset = self._cw.execute(rql_command)
Then, you can use the data from the rset.
@@ -25,12 +25,12 @@
``````````````````````````````````
Let's say you want to get T which is in configuration C, this translates to ::
- self.req.execute('Any T WHERE T in_conf C, C eid "%s"' % entity.eid)
+ self._cw.execute('Any T WHERE T in_conf C, C eid "%s"' % entity.eid)
But it can also be written in a syntax that will benefit from the use
of a cache on the RQL server side. ::
- self.req.execute('Any T WHERE T in_conf C, C eid %(x)s', {'x': entity.eid}, 'x')
+ self._cw.execute('Any T WHERE T in_conf C, C eid %(x)s', {'x': entity.eid}, 'x')
The syntax tree is build once for the "generic" RQL and can be re-used
with a number of different eid. Alternativelly, some of the common
--- a/doc/book/en/development/devweb/index.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devweb/index.rst Wed Feb 03 18:44:24 2010 +0100
@@ -6,7 +6,7 @@
.. toctree::
:maxdepth: 1
- request
+ ._cwuest
publisher
controllers
property
--- a/doc/book/en/development/devweb/internationalization.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devweb/internationalization.rst Wed Feb 03 18:44:24 2010 +0100
@@ -35,7 +35,7 @@
OR
- * by using the equivalent request's method ::
+ * by using the equivalent._cwuest's method ::
class NoResultView(EmptyRsetView):
"""default view when no result has been found"""
@@ -43,23 +43,23 @@
def call(self, **kwargs):
self.w(u'<div class="searchMessage"><strong>%s</strong></div>\n'
- % self.req._('No result matching query'))
+ % self._cw._('No result matching query'))
The goal of the *built-in* function `_` is only **to mark the
translatable strings**, it will only return the string to translate
itself, but not its translation (it's actually another name for the
`unicode` builtin).
-In the other hand the request's method `self.req._` is meant to retrieve the
-proper translation of translation strings in the requested language.
+In the other hand the._cwuest's method `self._cw._` is meant to retrieve the
+proper translation of translation strings in the._cwuested language.
-Finally you can also use the `__` attribute of request object to get a
+Finally you can also use the `__` attribute of._cwuest object to get a
translation for a string *which should not itself added to the catalog*,
usually in case where the actual msgid is created by string interpolation ::
- self.req.__('This %s' % etype)
+ self._cw.__('This %s' % etype)
-In this example `req.__` is used instead of `req._` so we don't have 'This %s' in
+In this example ._cw.__` is used instead of ._cw._` so we don't have 'This %s' in
messages catalogs.
--- a/doc/book/en/development/devweb/js.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devweb/js.rst Wed Feb 03 18:44:24 2010 +0100
@@ -27,7 +27,7 @@
~~~~~~~~~~~~~~~~~~~~~~~
Javascript resources are typically loaded on demand, from views. The
-request object (available as self.req from most application objects,
+request object (available as self._cw from most application objects,
for instance views and entities objects) has a few methods to do that:
* `add_js(self, jsfiles, localfile=True)` which takes a sequence of
--- a/doc/book/en/development/devweb/request.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devweb/request.rst Wed Feb 03 18:44:24 2010 +0100
@@ -3,10 +3,10 @@
The `Request` class (`cubicweb.web`)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-A request instance is created when an HTTP request is sent to the web server.
+A._cwuest instance is created when an HTTP._cwuest is sent to the web server.
It contains informations such as form parameters, user authenticated, etc.
-**Globally, a request represents a user query, either through HTTP or not
+**Globally, a._cwuest represents a user query, either through HTTP or not
(we also talk about RQL queries on the server side for example).**
An instance of `Request` has the following attributes:
@@ -36,21 +36,21 @@
* `remove_cookie(cookie, key)`, forces a value to expire
:URL handling:
- * `url()`, returns the full URL of the HTTP request
+ * `url()`, returns the full URL of the HTTP._cwuest
* `base_url()`, returns the root URL of the web application
- * `relative_path()`, returns the relative path of the request
+ * `relative_path()`, returns the relative path of the._cwuest
:And more...:
* `set_content_type(content_type, filename=None)`, adds the header HTTP
'Content-Type'
* `get_header(header)`, returns the value associated to an arbitrary header
- of the HTTP request
+ of the HTTP._cwuest
* `set_header(header, value)`, adds an arbitrary header in the response
* `cursor()` returns a RQL cursor on the session
* `execute(*args, **kwargs)`, shortcut to ``.cursor().execute()``
* `property_value(key)`, properties management (`CWProperty`)
* dictionary `data` to store data to share informations between components
- *while a request is executed*
+ *while a._cwuest is executed*
Please note that this class is abstract and that a concrete implementation
will be provided by the *frontend* web used (in particular *twisted* as of
--- a/doc/book/en/development/devweb/views.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/devweb/views.rst Wed Feb 03 18:44:24 2010 +0100
@@ -15,7 +15,7 @@
A `View` is an object applied to another object such as an entity.
Basic class for views
----------------------
+~~~~~~~~~~~~~~~~~~~~~
Class `View` (`cubicweb.view`)
`````````````````````````````````````
@@ -34,7 +34,7 @@
* the `category` attribute may be used in the interface to regroup related
objects together
-At instantiation time, the standard `req` and `rset` attributes are
+At instantiation time, the standard ._cw` and `rset` attributes are
added and the `w` attribute will be set at rendering time.
A view writes to its output stream thanks to its attribute `w` (an
@@ -58,7 +58,7 @@
* `view(__vid, rset, __fallback_vid=None, **kwargs)`, call the view of identifier
`__vid` on the given result set. It is possible to give a view identifier
- of fallback that will be used if the view requested is not applicable to the
+ of fallback that will be used if the view._cwuested is not applicable to the
result set. This is actually defined on the AppObject class.
* `wview(__vid, rset, __fallback_vid=None, **kwargs)`, similar to `view` except
@@ -75,7 +75,7 @@
that are more concrete as they relate to data rendering within the application:
* `EntityView`, view applying to lines or cell containing an entity (e.g. an eid)
-* `StartupView`, start view that does not require a result set to apply to
+* `StartupView`, start view that does not._cwuire a result set to apply to
* `AnyRsetView`, view applicable to any result set
* `EmptyRsetView`, view applicable to an empty result set
@@ -110,7 +110,7 @@
Example of view customization and creation
-------------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We'll show you now an example of a ``primary`` view and how to customize it.
@@ -157,7 +157,7 @@
rql = 'Any BE ORDERBY D DESC WHERE BE entry_of B, BE publish_date D, B eid %(b)s'
def render_entity_relations(self, entity):
- rset = self.req.execute(self.rql, {'b' : entity.eid})
+ rset = self._cw.execute(self.rql, {'b' : entity.eid})
for entry in rset.entities():
self.w(u'<p>%s</p>' % entry.view('inblogcontext'))
@@ -166,7 +166,7 @@
__select__ = implements('BlogEntry')
def cell_call(self, row, col):
- entity = self.rset.get_entity(row, col)
+ entity = self.cw_rset.get_entity(row, col)
self.w(u'<a href="%s" title="%s">%s</a>' %
entity.absolute_url(),
xml_escape(entity.content[:50]),
@@ -176,14 +176,14 @@
render_entity_relations method of a Blog's primary view. Here we want
to display our blog entries in a custom way.
-At `line 10`, a simple request is made to build a result set with all
+At `line 10`, a simple._cwuest is made to build a result set with all
the entities linked to the current ``Blog`` entity by the relationship
-``entry_of``. The part of the framework handling the request knows
+``entry_of``. The part of the framework handling the._cwuest knows
about the schema and infers that such entities have to be of the
``BlogEntry`` kind and retrieves them (in the prescribed publish_date
order).
-The request returns a selection of data called a result set. Result
+The._cwuest returns a selection of data called a result set. Result
set objects have an .entities() method returning a generator on
requested entities (going transparently through the `ORM` layer).
@@ -210,7 +210,7 @@
**This is to be compared to interfaces and protocols in object-oriented
languages. Applying a given view called 'a_view' to all the entities
-of a result set only requires to have for each entity of this result set,
+of a result set only._cwuires to have for each entity of this result set,
an available view called 'a_view' which accepts the entity.
Instead of merely using type based dispatch, we do predicate dispatch
@@ -223,7 +223,7 @@
:alt: a blog and all its entries
**Before we move forward, remember that the selection/view principle is
-at the core of *CubicWeb*. Everywhere in the engine, data is requested
+at the core of *CubicWeb*. Everywhere in the engine, data is._cwuested
using the RQL language, then HTML/XML/text/PNG is output by applying a
view to the result set returned by the query. That is where most of the
flexibility comes from.**
@@ -252,8 +252,8 @@
[FILLME]
-XML views, binaries...
-----------------------
+XML views, binaries views...
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
For views generating other formats than HTML (an image generated dynamically
for example), and which can not simply be included in the HTML page generated
--- a/doc/book/en/development/entityclasses/data-as-objects.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/entityclasses/data-as-objects.rst Wed Feb 03 18:44:24 2010 +0100
@@ -30,9 +30,9 @@
:Data handling:
* `as_rset()`, converts the entity into an equivalent result set simulating the
- request `Any X WHERE X eid _eid_`
+ ._cwuest `Any X WHERE X eid _eid_`
- * `complete(skip_bytes=True)`, executes a request that recovers all at once
+ * `complete(skip_bytes=True)`, executes a._cwuest that recovers all at once
all the missing attributes of an entity
* `get_value(name)`, returns the value associated to the attribute name given
@@ -54,7 +54,7 @@
* `delete()` allows to delete the entity
-Tne :class:`AnyEntity` class
+The :class:`AnyEntity` class
----------------------------
To provide a specific behavior for each entity, we have to define a class
@@ -90,3 +90,22 @@
* `dc_type(form='')`, returns a string to display the entity type by
specifying the preferred form (`plural` for a plural form)
+
+
+Inheritance
+-----------
+
+When describing a data model, entities can inherit from other entities as is
+common in object-oriented programming.
+
+You have the possibility to adapt some entity attributes, as follow:
+
+.. sourcecode:: python
+
+ from cubes.OTHER_CUBE import entities
+ class EntityExample(entities.EntityExample):
+ def dc_long_title(self):
+ return '%s (%s)' % (self.name, self.description)
+
+Notice this is different than yams schema inheritance.
+
--- a/doc/book/en/development/entityclasses/interfaces.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/entityclasses/interfaces.rst Wed Feb 03 18:44:24 2010 +0100
@@ -14,6 +14,7 @@
Interfaces defined in the library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-automodule:: cubicweb.interface :members:
+.. automodule:: cubicweb.interface
+ :members:
--- a/doc/book/en/development/entityclasses/load-sort.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/entityclasses/load-sort.rst Wed Feb 03 18:44:24 2010 +0100
@@ -11,7 +11,7 @@
* The class method `fetch_order(attr, var)` expects an attribute (or relation)
name as a parameter and a variable name, and it should return a string
- to use in the requirement `ORDERBY` of an RQL query to automatically
+ to use in the._cwuirement `ORDERBY` of an RQL query to automatically
sort the list of entities of such type according to this attribute, or
`None` if we do not want to sort on the attribute given in the parameter.
By default, the entities are sorted according to their creation date.
--- a/doc/book/en/development/migration/index.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/migration/index.rst Wed Feb 03 18:44:24 2010 +0100
@@ -79,7 +79,7 @@
In the `repository` scripts, the following identifiers are also defined:
-* `checkpoint`, request confirming and executing a "commit" at checking point
+* `checkpoint`,._cwuest confirming and executing a "commit" at checking point
* `schema`, instance schema (readen from the database)
@@ -165,7 +165,7 @@
* `add_state(name, stateof, initial=False, commit=False, **kwargs)`, adds a new state
in the workflow.
-* `add_transition(name, transitionof, fromstates, tostate, requiredgroups=(), commit=False, **kwargs)`,
+* `add_transition(name, transitionof, fromstates, tostate,._cwuiredgroups=(), commit=False, **kwargs)`,
adds a new transition in the workflow.
You can find more details about workflows in the chapter :ref:`Workflow` .
--- a/doc/book/en/development/webstdlib/basetemplates.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/webstdlib/basetemplates.rst Wed Feb 03 18:44:24 2010 +0100
@@ -45,25 +45,25 @@
"""build the top menu with authentification info and the rql box"""
self.w(u'<table id="header"><tr>\n')
self.w(u'<td id="firstcolumn">')
- self.vreg.select_component('logo', self.req, self.rset).dispatch(w=self.w)
+ self._cw.vreg.select_component('logo', self._cw, self.cw_rset).dispatch(w=self.w)
self.w(u'</td>\n')
# appliname and breadcrumbs
self.w(u'<td id="headtext">')
- comp = self.vreg.select_component('appliname', self.req, self.rset)
+ comp = self._cw.vreg.select_component('appliname', self._cw, self.cw_rset)
if comp and comp.propval('visible'):
comp.dispatch(w=self.w)
- comp = self.vreg.select_component('breadcrumbs', self.req, self.rset, view=view)
+ comp = self._cw.vreg.select_component('breadcrumbs', self._cw, self.cw_rset, view=view)
if comp and comp.propval('visible'):
comp.dispatch(w=self.w, view=view)
self.w(u'</td>')
# logged user and help
#self.w(u'<td>\n')
- #comp = self.vreg.select_component('loggeduserlink', self.req, self.rset)
+ #comp = self._cw.vreg.select_component('loggeduserlink', self._cw, self.cw_rset)
#comp.dispatch(w=self.w)
#self.w(u'</td><td>')
self.w(u'<td>')
- helpcomp = self.vreg.select_component('help', self.req, self.rset)
+ helpcomp = self._cw.vreg.select_component('help', self._cw, self.cw_rset)
if helpcomp: # may not be available if Card is not defined in the schema
helpcomp.dispatch(w=self.w)
self.w(u'</td>')
@@ -71,7 +71,7 @@
self.w(u'<td id="lastcolumn">')
self.w(u'</td>\n')
self.w(u'</tr></table>\n')
- self.template('logform', rset=self.rset, id='popupLoginBox', klass='hidden',
+ self.template('logform', rset=self.cw_rset, id='popupLoginBox', klass='hidden',
title=False, message=False)
@@ -90,21 +90,21 @@
"""build the top menu with authentification info and the rql box"""
self.w(u'<table id="header"><tr>\n')
self.w(u'<td id="firstcolumn">')
- self.vreg.select_component('logo', self.req, self.rset).dispatch(w=self.w)
+ self._cw.vreg.select_component('logo', self._cw, self.cw_rset).dispatch(w=self.w)
self.w(u'</td>\n')
# appliname and breadcrumbs
self.w(u'<td id="headtext">')
- comp = self.vreg.select_component('appliname', self.req, self.rset)
+ comp = self._cw.vreg.select_component('appliname', self._cw, self.cw_rset)
if comp and comp.propval('visible'):
comp.dispatch(w=self.w)
- comp = self.vreg.select_component('breadcrumbs', self.req, self.rset, view=view)
+ comp = self._cw.vreg.select_component('breadcrumbs', self._cw, self.cw_rset, view=view)
if comp and comp.propval('visible'):
comp.dispatch(w=self.w, view=view)
self.w(u'</td>')
# logged user and help
#self.w(u'<td>\n')
- #comp = self.vreg.select_component('loggeduserlink', self.req, self.rset)
+ #comp = self._cw.vreg.select_component('loggeduserlink', self._cw, self.cw_rset)
#comp.dispatch(w=self.w)
#self.w(u'</td><td>')
@@ -114,7 +114,7 @@
self.w(u'</td>')
self.w(u'<td>')
- helpcomp = self.vreg.select_component('help', self.req, self.rset)
+ helpcomp = self._cw.vreg.select_component('help', self._cw, self.cw_rset)
if helpcomp: # may not be available if Card is not defined in the schema
helpcomp.dispatch(w=self.w)
self.w(u'</td>')
@@ -122,11 +122,11 @@
self.w(u'<td id="lastcolumn">')
self.w(u'</td>\n')
self.w(u'</tr></table>\n')
- self.template('logform', rset=self.rset, id='popupLoginBox', klass='hidden',
+ self.template('logform', rset=self.cw_rset, id='popupLoginBox', klass='hidden',
title=False, message=False)
def get_searchbox(self, view, context):
- boxes = list(self.vreg.poss_visible_objects('boxes', self.req, self.rset,
+ boxes = list(self._cw.vreg.poss_visible_objects('boxes', self._cw, self.cw_rset,
view=view, context=context))
if boxes:
for box in boxes:
@@ -150,7 +150,7 @@
self.w(u'This website has been created with <a href="http://cubicweb.org">CubicWeb</a>.')
self.w(u'</div>')
-Updating a view does not require any restart of the server. By reloading
+Updating a view does not._cwuire any restart of the server. By reloading
the page you can see your new page footer.
--- a/doc/book/en/development/webstdlib/editcontroller.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/webstdlib/editcontroller.rst Wed Feb 03 18:44:24 2010 +0100
@@ -6,7 +6,7 @@
Editing control
~~~~~~~~~~~~~~~~
-Re-requisites: the parameters related to entities to edit are
+Re._cwuisites: the parameters related to entities to edit are
specified as follows ::
<field name>:<entity eid>
@@ -26,7 +26,7 @@
for this relaiton and we then look for the new value(s) in the parameter
<relation name> (qualified)
3. if the value returned is different from the initial value, an database update
- request is done
+ ._cwuest is done
3. For each entity to edit:
@@ -102,7 +102,7 @@
* `__redirectparams`: forms parameters to add to the path
-* `__redirectrql`: redirection RQL request
+* `__redirectrql`: redirection RQL._cwuest
* `__redirectvid`: redirection view identifier
--- a/doc/book/en/development/webstdlib/primary.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/webstdlib/primary.rst Wed Feb 03 18:44:24 2010 +0100
@@ -40,7 +40,7 @@
def cell_call(self, row, col):
self.row = row
- self.maxrelated = self.req.property_value('navigation.related-limit')
+ self.maxrelated = self._cw.property_value('navigation.related-limit')
entity = self.complete_entity(row, col)
self.render_entity(entity)
--- a/doc/book/en/development/webstdlib/startup.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/development/webstdlib/startup.rst Wed Feb 03 18:44:24 2010 +0100
@@ -5,7 +5,7 @@
Views that don't apply to a result set
*index*
- This view defines the home page of your application. It does not require
+ This view defines the home page of your application. It does not._cwuire
a result set to apply to.
*schema*
--- a/doc/book/en/index.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/index.rst Wed Feb 03 18:44:24 2010 +0100
@@ -3,10 +3,10 @@
.. _contents:
=====================================================
-*CubicWeb* - The Semantic Web is a construction game!
+|cubicweb| - The Semantic Web is a construction game!
=====================================================
-*CubicWeb* is a semantic web application framework, licensed under the LGPL,
+|cubicweb| is a semantic web application framework, licensed under the LGPL,
that empowers developers to efficiently build web applications by reusing
components (called `cubes`) and following the well known object-oriented design
principles.
@@ -21,7 +21,7 @@
* the reliability of SQL databases, LDAP directories, Subversion and Mercurial for storage backends.
Built since 2000 from an R&D effort still continued, supporting 100,000s of
-daily visits at some production sites, *CubicWeb* is a proven end to end solution
+daily visits at some production sites, |cubicweb| is a proven end to end solution
for semantic web application development that promotes quality, reusability and
efficiency.
@@ -58,3 +58,4 @@
* the :ref:`modindex`,
* and the :ref:`search`.
+.. |cubicweb| replace:: *CubicWeb*
\ No newline at end of file
--- a/doc/book/en/intro/concepts/index.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/intro/concepts/index.rst Wed Feb 03 18:44:24 2010 +0100
@@ -2,10 +2,10 @@
.. _Concepts:
-The Core Concepts of CubicWeb
-=============================
+The Core Concepts of |cubicweb|
+===============================
-This section defines some terms and core concepts of the *CubicWeb*
+This section defines some terms and core concepts of the |cubicweb|
framework. To avoid confusion while reading this book, take time to go through
the following definitions and use this section as a reference during your
reading.
@@ -24,19 +24,19 @@
and `cubicweb-comment`_ could be used to make a cube named *myblog* with
commentable blog entries.
-The `CubicWeb Forge`_ offers a large number of cubes developed by the community
+The `|cubicweb| Forge`_ offers a large number of cubes developed by the community
and available under a free software license.
-The command ``cubicweb-ctl list`` displays the list of cubes installed on your
+The command :command:`cubicweb-ctl list` displays the list of cubes installed on your
system.
On a Unix system, the available cubes are usually stored in the directory
-:file:`/usr/share/cubicweb/cubes`. During development, the cubes are commonly
-found in the directory :file:`/path/to/cubicweb_forest/cubes`. The environment
-variable :envvar:`CW_CUBES_PATH` gives additionnal locations where to search for
-cubes.
+:file:`/usr/share/cubicweb/cubes`. If you're using the cubicweb forest
+(:ref:SourceInstallation), the cubes are searched in the directory
+:file:`/path/to/cubicweb_forest/cubes`. The environment variable
+:envvar:`CW_CUBES_PATH` gives additionnal locations where to search for cubes.
-.. _`CubicWeb Forge`: http://www.cubicweb.org/project/
+.. _`|cubicweb| Forge`: http://www.cubicweb.org/project/
.. _`cubicweb-blog`: http://www.cubicweb.org/project/cubicweb-blog
.. _`cubicweb-comment`: http://www.cubicweb.org/project/cubicweb-comment
@@ -59,7 +59,7 @@
.. image:: ../../images/archi_globale.en.png
-The command ``cubicweb-ctl list`` also displays the list of instances
+The command :command:`cubicweb-ctl list` also displays the list of instances
installed on your system.
On a Unix system, the instances are usually stored in the directory
@@ -75,17 +75,17 @@
Data Repository
---------------
-The data repository [#]_ provides access to one or more data sources (including
+The data repository [1]_ provides access to one or more data sources (including
SQL databases, LDAP repositories, Mercurial or Subversion version control
-systems, other CubicWeb instance repositories, GAE's DataStore, etc).
+systems, other |cubicweb| instance repositories, GAE's DataStore, etc).
All interactions with the repository are done using the Relation Query Language
(RQL). The repository federates the data sources and hides them from the
querier, which does not realize when a query spans accross several data sources
-and requires running sub-queries and merges to complete.
+and._cwuires running sub-queries and merges to complete.
It is common to run the web engine and the repository in the same process (see
-instances of type all-in-one above), but this is not a requirement. A repository
+instances of type all-in-one above), but this is not a._cwuirement. A repository
can be set up to be accessed remotely using Pyro (`Python Remote Objects`_) and
act as a server.
@@ -93,13 +93,13 @@
creation of entities, deletion of relations, etc. This is used for example to
send email notifications when the state of an object changes. See `Hooks` below.
-.. _[#]: not to be confused with a Mercurial repository or a Debian repository.
+.. [1] not to be confused with a Mercurial repository or a Debian repository.
.. _`Python Remote Objects`: http://pyro.sourceforge.net/
Web Engine
----------
-The web engine replies to http requests and runs the user interface
+The web engine replies to http._cwuests and runs the user interface
and most of the application logic.
By default the web engine provides a default user interface based on
@@ -135,7 +135,7 @@
entities like users and groups, the entities used to store the data model
itself and attributes like unique identifier, creation date, creator, etc.
-When you create a new *CubicWeb* instance, the schema is stored in the database.
+When you create a new |cubicweb| instance, the schema is stored in the database.
When the cubes the instance is based on evolve, they may change their data model
and provide migration scripts that will be executed when the administrator will
run the upgrade process for the instance.
@@ -173,7 +173,7 @@
Each appobject has a selector, that is used to compute how well the object fits
a given context. The better the object fits the context, the higher the score.
-CubicWeb provides a set of basic selectors that may be parametrized. Selectors
+|cubicweb| provides a set of basic selectors that may be parametrized. Selectors
can be combined with the binary operators `&` and `|` to build more complex
selector that can be combined too.
@@ -213,7 +213,7 @@
**No need for a complicated ORM when you have a powerful query language**
-All the persistent data in a CubicWeb instance is retrieved and modified by using the
+All the persistent data in a |cubicweb| instance is retrieved and modified by using the
Relation Query Language.
This query language is inspired by SQL but is on a higher level in order to
@@ -228,10 +228,10 @@
Result set
~~~~~~~~~~
-Every request made (using RQL) to the data repository returns an
+Every._cwuest made (using RQL) to the data repository returns an
object we call a Result Set. It enables easy use of the retrieved
data, providing a translation layer between the backend's native
-datatypes and *CubicWeb* schema's EntityTypes.
+datatypes and |cubicweb| schema's EntityTypes.
Result sets provide access to the raw data, yielding either basic
Python data types, or schema-defined high-level entities, in a
@@ -241,7 +241,7 @@
Views
-----
-** *CubicWeb* is data driven **
+**CubicWeb| is data driven**
The view system is loosely coupled to data through a selection
system. Views are, in essence, defined by an id, a selection predicate
@@ -252,7 +252,8 @@
Hooks
-----
-** *CubicWeb* provides an extensible data repository **
+
+**CubicWeb provides an extensible data repository**
The data model defined using Yams types allows to express the data
model in a comfortable way. However several aspects of the data model
@@ -282,3 +283,35 @@
They are an essential building block of any moderately complicated
cubicweb application.
+
+
+.. _RunMode:
+
+Running mode
+------------
+
+A running mode is a predifined set of configuration telling where it should look
+for various resources, such as cubes, instances, etc. To ease development with
+the framework, there are two running modes with |cubicweb|:
+
+* 'user', resources are searched / created in the user home directory:
+ - instances are stored in :file:`~/etc/cubicweb.d`
+ - temporary files (such as pid file) in :file:`/tmp`
+
+* 'system', resources are searched / created in the system directories (eg usually._cwuiring root access):
+ - instances are stored in :file:`/etc/cubicweb.d`
+ - temporary files (such as pid file) in :file:`/var/run/cubicweb`
+
+Cubes search path is also affected, see the :ref:Cube section.
+
+By default, the mode automatically set to 'user' if a :file:`.hg` directory is found
+in the cubicweb package, else it's set to 'system'. You can force this by setting
+the :envvar:`CW_MODE` environment variable to either 'user' or 'system'.
+
+If you've a doubt about the mode you're currently running, check the first line
+outputed by the :command:`cubicweb-ctl list` command.
+
+Notice that each resource path may be explicitly set using an environment
+variable if the default doesn't suit your needs.
+
+.. |cubicweb| replace:: *CubicWeb*
\ No newline at end of file
--- a/doc/book/en/intro/history.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/intro/history.rst Wed Feb 03 18:44:24 2010 +0100
@@ -8,8 +8,7 @@
is written in Python and includes a data server and a web engine.
Its data server publishes data federated from different sources like SQL
-databases, LDAP directories and versioning systems (such as subversion or
-mercurial).
+databases, LDAP directories or even from other CubicWeb data servers.
Its web engine was designed to let the final user control what content to select
and how to display it. It allows one to browse the federated data sources and
--- a/doc/book/en/intro/tutorial/create-cube.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/intro/tutorial/create-cube.rst Wed Feb 03 18:44:24 2010 +0100
@@ -86,13 +86,13 @@
from yams.buildobjs import EntityType, String, SubjectRelation, Date
class Blog(EntityType):
- title = String(maxsize=50, required=True)
+ title = String(maxsize=50,._cwuired=True)
description = String()
class BlogEntry(EntityType):
- title = String(required=True, fulltextindexed=True, maxsize=256)
+ title = String._cwuired=True, fulltextindexed=True, maxsize=256)
publish_date = Date(default='TODAY')
- content = String(required=True, fulltextindexed=True)
+ content = String._cwuired=True, fulltextindexed=True)
entry_of = SubjectRelation('Blog', cardinality='?*')
The first step is the import of the EntityType (generic class for entity and
@@ -103,7 +103,7 @@
description is a string that is not constrained.
A BlogEntry has a title, a publish_date and a content. The title is a
-string that is required and must be less than 100 characters. The
+string that is._cwuired and must be less than 100 characters. The
publish_date is a Date with a default value of TODAY, meaning that
when a BlogEntry is created, its publish_date will be the current day
unless it is modified. The content is a string that will be indexed in
@@ -321,7 +321,7 @@
super(BlogEntryPrimaryView, self).render_entity_attributes(entity)
.. note::
- When a view is modified, it is not required to restart the instance
+ When a view is modified, it is not._cwuired to restart the instance
server. Save the Python file and reload the page in your web browser
to view the changes.
@@ -367,7 +367,7 @@
else:
return False
-Customizing an entity requires that your entity:
+Customizing an entity._cwuires that your entity:
- inherits from ``cubicweb.entities`` or any subclass
- defines a ``__regid__`` linked to the corresponding data type of your schema
- implements the base class by explicitly using ``__implements__``.
@@ -397,15 +397,15 @@
While developping your cube, you may want to update your data model. Let's say you
want to add a ``category`` attribute in the ``Blog`` data type. This is called a migration.
-The required steps are:
+The._cwuired steps are:
1. modify the file ``schema.py``. The ``Blog`` class looks now like this:
.. sourcecode:: python
class Blog(EntityType):
- title = String(maxsize=50, required=True)
+ title = String(maxsize=50,._cwuired=True)
description = String()
- category = String(required=True, vocabulary=(_('Professional'), _('Personal')), default='Personal')
+ category = String._cwuired=True, vocabulary=(_('Professional'), _('Personal')), default='Personal')
2. stop your ``blogdemo`` instance
--- a/doc/book/en/intro/tutorial/maintemplate.rst Wed Feb 03 14:46:32 2010 +0100
+++ b/doc/book/en/intro/tutorial/maintemplate.rst Wed Feb 03 18:44:24 2010 +0100
@@ -52,25 +52,25 @@
"""build the top menu with authentification info and the rql box"""
self.w(u'<table id="header"><tr>\n')
self.w(u'<td id="firstcolumn">')
- self.vreg.select_component('logo', self.req, self.rset).dispatch(w=self.w)
+ self._cw.vreg.select_component('logo', self._cw, self.cw_rset).dispatch(w=self.w)
self.w(u'</td>\n')
# appliname and breadcrumbs
self.w(u'<td id="headtext">')
- comp = self.vreg.select_component('appliname', self.req, self.rset)
+ comp = self._cw.vreg.select_component('appliname', self._cw, self.cw_rset)
if comp and comp.propval('visible'):
comp.dispatch(w=self.w)
- comp = self.vreg.select_component('breadcrumbs', self.req, self.rset, view=view)
+ comp = self._cw.vreg.select_component('breadcrumbs', self._cw, self.cw_rset, view=view)
if comp and comp.propval('visible'):
comp.dispatch(w=self.w, view=view)
self.w(u'</td>')
# logged user and help
#self.w(u'<td>\n')
- #comp = self.vreg.select_component('loggeduserlink', self.req, self.rset)
+ #comp = self._cw.vreg.select_component('loggeduserlink', self._cw, self.cw_rset)
#comp.dispatch(w=self.w)
#self.w(u'</td><td>')
self.w(u'<td>')
- helpcomp = self.vreg.select_component('help', self.req, self.rset)
+ helpcomp = self._cw.vreg.select_component('help', self._cw, self.cw_rset)
if helpcomp: # may not be available if Card is not defined in the schema
helpcomp.dispatch(w=self.w)
self.w(u'</td>')
@@ -78,7 +78,7 @@
self.w(u'<td id="lastcolumn">')
self.w(u'</td>\n')
self.w(u'</tr></table>\n')
- self.template('logform', rset=self.rset, id='popupLoginBox', klass='hidden',
+ self.template('logform', rset=self.cw_rset, id='popupLoginBox', klass='hidden',
title=False, message=False)
@@ -102,7 +102,7 @@
self.w(u'This website has been created with <a href="http://cubicweb.org">CubicWeb</a>.')
self.w(u'</div>')
-Updating a view does not require any restart of the server. By reloading
+Updating a view does not._cwuire any restart of the server. By reloading
the page you can see your new page footer.