--- a/doc/book/en/annexes/faq.rst Thu May 07 16:33:22 2009 +0200
+++ b/doc/book/en/annexes/faq.rst Thu May 07 16:42:34 2009 +0200
@@ -11,7 +11,8 @@
http://groups.google.com/group/google-appengine/browse_frm/thread/f48cf6099973aef5/c28cd6934dd72457
]
-* Why does not CubicWeb have a template language ?
+Why does not CubicWeb have a template language ?
+------------------------------------------------
There are enough template languages out there. You can use your
preferred template language if you want. [explain how to use a
@@ -28,7 +29,8 @@
The reason template languages are not used in this book is that
experience has proved us that using pure python was less cumbersome.
-* Why do you think using pure python is better than using a template language ?
+Why do you think using pure python is better than using a template language ?
+-----------------------------------------------------------------------------
Python is an Object Oriented Programming language and as such it
already provides a consistent and strong architecture and syntax
@@ -43,7 +45,8 @@
we use standard OOP techniques and this is a key factor in a
robust application.
-* Why do you use the GPL license to prevent me from doing X ?
+Why do you use the GPL license to prevent me from doing X ?
+-----------------------------------------------------------
GPL means that *if* you redistribute your application, you need to
redistribute it *and* the changes you made *and* the code _linked_
@@ -58,14 +61,16 @@
clients.
-* CubicWeb looks pretty recent. Is it stable ?
+CubicWeb looks pretty recent. Is it stable ?
+--------------------------------------------
It is constantly evolving, piece by piece. The framework has
evolved over the past seven years and data has been migrated from
one schema to the other ever since. There is a well-defined way to
handle data and schema migration.
-* Why is the RQL query language looking similar to X ?
+Why is the RQL query language looking similar to X ?
+-----------------------------------------------------
It may remind you of SQL but it is higher level than SQL, more like
SPARQL. Except that SPARQL did not exist when we started the project.
@@ -89,12 +94,12 @@
[copy answer from forum, explain why similar to sparql and why better
than django and SQL]
-* which ajax library
-
+which ajax library
+------------------
[we use jquery and things on top of that]
-* `Error while publishing rest text ...`
-
+`Error while publishing rest text ...`
+--------------------------------------
While modifying the description of an entity, you get an error message in
the application `Error while publishing ...` for Rest text and plain text.
The server returns a traceback like as follows ::
@@ -110,7 +115,8 @@
This can be fixed by applying the patch described in :
http://code.google.com/p/googleappengine/issues/detail?id=48
-* What are hooks used for?
+What are hooks used for?
+------------------------
Hooks are executed around (actually before or after) events. The
most common events are data creation, update and deletion. They
@@ -123,19 +129,22 @@
Other kinds of hooks, called Operations, are available
for execution just before commit.
-* When should you define an HTML template rather than define a graphical component?
+When should you define an HTML template rather than define a graphical component?
+---------------------------------------------------------------------------------
An HTML template cannot contain code, hence it is only about static
content. A component is made of code and operations that apply on a
well defined context (request, result set). It enables much more
dynamic views.
-* What is the difference between `AppRsetObject` and `AppObject` ?
+What is the difference between `AppRsetObject` and `AppObject` ?
+----------------------------------------------------------------
`AppRsetObject` instances are selected on a request and a result
set. `AppObject` instances are directly selected by id.
-* How to update a database after a schema modification?
+How to update a database after a schema modification?
+-----------------------------------------------------
It depends on what has been modified in the schema.
@@ -150,7 +159,8 @@
* Add a relation: ``add_relation_definition('SubjRelation', 'MyRelation', 'ObjRelation')``.
-* How to create an anonymous user?
+How to create an anonymous user?
+--------------------------------
This allows to bypass authentication for your site. In the
``all-in-one.conf`` file of your instance, define the anonymous user
@@ -175,7 +185,8 @@
decribed above.
-* How to change the application logo?
+How to change the application logo?
+-----------------------------------
There are two ways of changing the logo.
@@ -193,7 +204,8 @@
where DATADIR is ``mycubes/data``.
-* How to configure LDAP source?
+How to configure LDAP source?
+-------------------------------
Your instance's sources are defined in ``/etc/cubicweb.d/myapp/sources``.
Configuring an LDAP source is about declaring that source in your
@@ -219,7 +231,8 @@
Any change applied to configuration file requires to restart your
application.
-* I get NoSelectableObject exceptions: how do I debug selectors ?
+I get NoSelectableObject exceptions: how do I debug selectors ?
+---------------------------------------------------------------
You just need to put the appropriate context manager around view/component
selection: ::
@@ -233,7 +246,8 @@
2009-01-09 16:43:52 - (cubicweb.selectors) WARNING: selector one_line_rset returned 0 for <class 'cubicweb.web.views.basecomponents.WFHistoryVComponent'>
-* How to format an entity date attribute?
+How to format an entity date attribute?
+---------------------------------------
If your schema has an attribute of type Date or Datetime, you might
want to format it. First, you should define your preferred format using
@@ -242,3 +256,82 @@
Then in the view code, use::
self.format_date(entity.date_attribute)
+
+Can PostgreSQL and CubicWeb authentication work with kerberos ?
+----------------------------------------------------------------
+
+ If you have postgresql set up to accept kerberos authentication, you can set
+ the db-host, db-name and db-user parameters in the `sources` configuration
+ file while leaving the password blank. It should be enough for your instance
+ to connect to postgresql with a kerberos ticket.
+
+
+How to load data from a script?
+-------------------------------
+
+ The following script aims at loading data within a script assuming pyro-nsd is
+ running and your application is configured with ``pyro-server=yes``, otherwise
+ you would not be able to use dbapi. ::
+
+ from cubicweb import dbapi
+
+ cnx = dbapi.connection(database='instance-id', user='admin', password='admin')
+ cur = cnx.cursor()
+ for name in ('Personal', 'Professional', 'Computers'):
+ cur.execute('INSERT Blog B: B name %s', name)
+ cnx.commit()
+
+What is the CubicWeb datatype corresponding to GAE datastore's UserProperty?
+----------------------------------------------------------------------------
+
+ If you take a look at your application schema and
+ click on "display detailed view of metadata" you will see that there
+ is a Euser entity in there. That's the one that is modeling users. The
+ thing that corresponds to a UserProperty is a relationship between
+ your entity and the Euser entity. As in ::
+
+ class TodoItem(EntityType):
+ text = String()
+ todo_by = SubjectRelation('Euser')
+
+ [XXX check that cw handle users better by
+ mapping Google Accounts to local Euser entities automatically]
+
+
+How to implement security?
+--------------------------
+
+ This is an example of how it works in our framework::
+
+ class Version(EntityType):
+ """a version is defining the content of a particular project's
+ release"""
+ # definition of attributes is voluntarily missing
+ 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'),)}
+
+ The above means that permission to read a Version is granted to any
+ user that is part of one of the groups 'managers', 'users', 'guests'.
+ The 'add' permission is granted to users in group 'managers' or
+ 'logilab' and to users in group G, if G is linked by a permission
+ entity named "add_version" to the version's project.
+ ::
+
+ class version_of(RelationType):
+ """link a version to its project. A version is necessarily linked
+ to one and only one project. """
+ # some lines voluntarily missing
+ 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'),) }
+
+ You can find additional information in the section :ref:`security`.
+
+ [XXX what does the second example means in addition to the first one?]
+