doc/book/en/D010-faq.en.txt
author Sandrine Ribeau <sandrine.ribeau@logilab.fr>
Tue, 05 May 2009 02:03:45 -0700
changeset 1677 35861bfca748
parent 1440 4fc48f2a1748
child 1678 67162cb05b4b
permissions -rw-r--r--
[doc] Change structure to make it more readable.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     1
.. -*- coding: utf-8 -*-
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
     2
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
     3
Frequently Asked Questions
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
     4
==========================
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
     5
310
cdd2b1247c50 [doc] add links to google-appengine forum
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 306
diff changeset
     6
[XXX 'copy answer from forum' means reusing text from
cdd2b1247c50 [doc] add links to google-appengine forum
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 306
diff changeset
     7
http://groups.google.com/group/google-appengine/browse_frm/thread/c9476925f5f66ec6
cdd2b1247c50 [doc] add links to google-appengine forum
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 306
diff changeset
     8
and
cdd2b1247c50 [doc] add links to google-appengine forum
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 306
diff changeset
     9
http://groups.google.com/group/google-appengine/browse_frm/thread/d791ce17e2716147/eb078f8cfe8426e0
cdd2b1247c50 [doc] add links to google-appengine forum
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 306
diff changeset
    10
and
cdd2b1247c50 [doc] add links to google-appengine forum
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 306
diff changeset
    11
http://groups.google.com/group/google-appengine/browse_frm/thread/f48cf6099973aef5/c28cd6934dd72457
cdd2b1247c50 [doc] add links to google-appengine forum
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 306
diff changeset
    12
]
cdd2b1247c50 [doc] add links to google-appengine forum
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 306
diff changeset
    13
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    14
Why does not CubicWeb have a template language ?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    15
------------------------------------------------
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    16
344
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    17
  There are enough template languages out there. You can use your
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    18
  preferred template language if you want. [explain how to use a
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    19
  template language]
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    20
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    21
  `CubicWeb` does not define its own templating language as this was
344
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    22
  not our goal. Based on our experience, we realized that
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    23
  we could gain productivity by letting designers use design tools
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    24
  and developpers develop without the use of the templating language
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    25
  as an intermediary that could not be anyway efficient for both parties.
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    26
  Python is the templating language that we use in `CubicWeb`, but again,
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    27
  it does not prevent you from using a templating language.
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    28
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    29
  The reason template languages are not used in this book is that
344
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    30
  experience has proved us that using pure python was less cumbersome.
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    31
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    32
Why do you think using pure python is better than using a template language ?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    33
-----------------------------------------------------------------------------
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    34
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    35
  Python is an Object Oriented Programming language and as such it
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    36
  already provides a consistent and strong architecture and syntax
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    37
  a templating language would not reach.
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    38
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    39
  When doing development, you need a real language and template
344
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    40
  languages are not real languages.
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    41
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    42
  Using Python enables developing applications for which code is
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    43
  easier to maintain with real functions/classes/contexts
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    44
  without the need of learning a new dialect. By using Python,
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    45
  we use standard OOP techniques and this is a key factor in a
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    46
  robust application.
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    47
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    48
Why do you use the GPL license to prevent me from doing X ?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    49
-----------------------------------------------------------
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    50
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    51
  GPL means that *if* you redistribute your application, you need to
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    52
  redistribute it *and* the changes you made *and* the code _linked_
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    53
  to it under the GPL licence.
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    54
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    55
  Publishing a web site has nothing to do with redistributing
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    56
  source code. A fair amount of companies use modified GPL code
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    57
  for internal use. And someone could publish a `CubicWeb` component
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    58
  under a BSD licence for others to plug into a GPL framework without
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    59
  any problem. The only thing we are trying to prevent here is someone
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    60
  taking the framework and packaging it as closed source to his own
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    61
  clients.
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    62
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    63
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    64
CubicWeb looks pretty recent. Is it stable ?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    65
--------------------------------------------
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    66
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    67
  It is constantly evolving, piece by piece.  The framework has
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    68
  evolved over the past seven years and data has been migrated from
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    69
  one schema to the other ever since. There is a well-defined way to
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
    70
  handle data and schema migration.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
    71
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    72
Why is the RQL query language looking similar to X ?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    73
----------------------------------------------------
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    74
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    75
  It may remind you of SQL but it is higher level than SQL, more like
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    76
  SPARQL. Except that SPARQL did not exist when we started the project.
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    77
  Having SPARQL has a query language has been in our backlog for years.
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    78
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    79
  That RQL language is what is going to make a difference with django-
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    80
  like frameworks for several reasons.
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    81
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    82
  1. accessing data is *much* easier with it. One can write complex
344
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    83
     queries with RQL that would be tedious to define and hard to maintain
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    84
     using an object/filter suite of method calls.
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    85
344
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    86
  2. it offers an abstraction layer allowing your applications to run
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    87
     on multiple back-ends. That means not only various SQL backends
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    88
     (postgresql, sqlite, mysql), but also multiple databases at the
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    89
     same time, and also non-SQL data stores like LDAP directories and
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    90
     subversion/mercurial repositories (see the `vcsfile`
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    91
     component). Google App Engine is yet another supported target for
e0d5879a613e tweak the faq a bit
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 337
diff changeset
    92
     RQL.
337
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    93
eb329d0db467 [doc] FAQ improvements based on posts in forums.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 335
diff changeset
    94
[copy answer from forum, explain why similar to sparql and why better
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    95
  than django and SQL]
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    96
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    97
which ajax library
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
    98
------------------
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
    99
317
cf1c6178b322 we've been using jquery for a while now
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents: 310
diff changeset
   100
  [we use jquery and things on top of that]
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   101
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   102
`Error while publishing rest text ...`
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   103
--------------------------------------
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   104
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   105
  While modifying the description of an entity, you get an error message in
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   106
  the application `Error while publishing ...` for Rest text and plain text.
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   107
  The server returns a traceback like as follows ::
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   108
1191
216141cf47a3 remove all erudi and ginco occurences in the doc
Emile Anclin <emile.anclin@logilab.fr>
parents: 383
diff changeset
   109
      2008-10-06 15:05:08 - (cubicweb.rest) ERROR: error while publishing ReST text
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   110
      Traceback (most recent call last):
1191
216141cf47a3 remove all erudi and ginco occurences in the doc
Emile Anclin <emile.anclin@logilab.fr>
parents: 383
diff changeset
   111
      File "/home/user/src/blogdemo/cubicweb/common/rest.py", line 217, in rest_publish
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   112
      File "/usr/lib/python2.5/codecs.py", line 817, in open
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   113
      file = __builtin__.open(filename, mode, buffering)
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   114
      TypeError: __init__() takes at most 3 arguments (4 given)
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   115
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   116
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   117
  This can be fixed by applying the patch described in :
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   118
  http://code.google.com/p/googleappengine/issues/detail?id=48
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   119
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   120
What are hooks used for?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   121
------------------------
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   122
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   123
  Hooks are executed around (actually before or after) events.  The
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   124
  most common events are data creation, update and deletion.  They
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   125
  permit additional constraint checking (those not expressible at the
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   126
  schema level), pre and post computations depending on data
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   127
  movements.
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   128
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   129
  As such, they are a vital part of the framework.
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   130
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   131
  Other kinds of hooks, called Operations, are available
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   132
  for execution just before commit.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   133
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   134
When should you define an HTML template rather than define a graphical component?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   135
---------------------------------------------------------------------------------
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   136
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   137
  An HTML template cannot contain code, hence it is only about static
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   138
  content.  A component is made of code and operations that apply on a
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   139
  well defined context (request, result set). It enables much more
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   140
  dynamic views.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   141
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   142
What is the difference between `AppRsetObject` and `AppObject` ?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   143
----------------------------------------------------------------
199
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   144
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   145
  `AppRsetObject` instances are selected on a request and a result
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   146
  set. `AppObject` instances are directly selected by id.
199
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   147
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   148
How to update a database after a schema modification?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   149
-----------------------------------------------------
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   150
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   151
  It depends on what has been modified in the schema.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   152
1350
31e4c8d30e5d [doc] Adds how to add attribute in DB.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1348
diff changeset
   153
  * Update of an attribute permissions and properties: 
31e4c8d30e5d [doc] Adds how to add attribute in DB.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1348
diff changeset
   154
    ``synchronize_eschema('MyEntity')``.
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   155
1350
31e4c8d30e5d [doc] Adds how to add attribute in DB.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1348
diff changeset
   156
  * Update of a relation permissions and properties: 
31e4c8d30e5d [doc] Adds how to add attribute in DB.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1348
diff changeset
   157
    ``synchronize_rschema('MyRelation')``.
31e4c8d30e5d [doc] Adds how to add attribute in DB.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1348
diff changeset
   158
31e4c8d30e5d [doc] Adds how to add attribute in DB.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1348
diff changeset
   159
  * Add an attribute: ``add_attribute('MyEntityType', 'myattr')``.
31e4c8d30e5d [doc] Adds how to add attribute in DB.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1348
diff changeset
   160
31e4c8d30e5d [doc] Adds how to add attribute in DB.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1348
diff changeset
   161
  * Add a relation: ``add_relation_definition('SubjRelation', 'MyRelation', 'ObjRelation')``.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   162
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   163
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   164
How to create an anonymous user?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   165
--------------------------------
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   166
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   167
  This allows to bypass authentication for your site. In the
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   168
  ``all-in-one.conf`` file of your instance, define the anonymous user
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   169
  as follows ::
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   170
1191
216141cf47a3 remove all erudi and ginco occurences in the doc
Emile Anclin <emile.anclin@logilab.fr>
parents: 383
diff changeset
   171
    # login of the CubicWeb user account to use for anonymous user (if you want to
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   172
    # allow anonymous)
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   173
    anonymous-user=anon
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   174
1191
216141cf47a3 remove all erudi and ginco occurences in the doc
Emile Anclin <emile.anclin@logilab.fr>
parents: 383
diff changeset
   175
    # password of the CubicWeb user account matching login
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   176
    anonymous-password=anon
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   177
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   178
  You also must ensure that this `anon` user is a registered user of
1348
28bb9efe0cc8 [doc] Add information on anonymous user configuration.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1191
diff changeset
   179
  the DB backend. If not, you can create through the administation
28bb9efe0cc8 [doc] Add information on anonymous user configuration.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1191
diff changeset
   180
  interface of your instance by adding a user with the role `guests`.
28bb9efe0cc8 [doc] Add information on anonymous user configuration.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1191
diff changeset
   181
  This could be the admin account (for development
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   182
  purposes, of course).
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   183
1348
28bb9efe0cc8 [doc] Add information on anonymous user configuration.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1191
diff changeset
   184
.. note::
28bb9efe0cc8 [doc] Add information on anonymous user configuration.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1191
diff changeset
   185
    While creating a new instance, you can decide to allow access
1378
3645800647ef [doc] Fix typo.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1354
diff changeset
   186
    to anonymous user, which will automatically execute what is
1348
28bb9efe0cc8 [doc] Add information on anonymous user configuration.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1191
diff changeset
   187
    decribed above.
28bb9efe0cc8 [doc] Add information on anonymous user configuration.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1191
diff changeset
   188
199
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   189
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   190
How to change the application logo?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   191
-----------------------------------
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   192
199
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   193
  There are two ways of changing the logo.
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   194
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   195
  1. The easiest way to use a different logo is to replace the existing
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   196
     ``logo.png`` in ``myapp/data`` by your prefered icon and refresh.
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   197
     By default all application will look for a ``logo.png`` to be
199
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   198
     rendered in the logo section.
93
9c919a47e140 [doc] total file reorganisation - phase 1 complete
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
diff changeset
   199
199
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   200
     .. image:: images/lax-book.06-main-template-logo.en.png
116
e2303f9b5bfa [doc] more merging and reorg
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents: 113
diff changeset
   201
199
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   202
  2. In your cube directory, you can specify which file to use for the logo.
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   203
     This is configurable in ``mycube/data/external_resources``: ::
345
31f88b2e3500 more translation and complements
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 344
diff changeset
   204
199
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   205
       LOGO = DATADIR/path/to/mylogo.gif
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   206
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   207
     where DATADIR is ``mycubes/data``.
c603087373cd [doc] Inserted content from LAX book about templates.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 127
diff changeset
   208
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   209
How to configure LDAP source?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   210
-----------------------------
335
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 317
diff changeset
   211
358
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   212
  Your instance's sources are defined in ``/etc/cubicweb.d/myapp/sources``.
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   213
  Configuring an LDAP source is about declaring that source in your
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   214
  instance configuration file such as: ::
335
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 317
diff changeset
   215
358
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   216
    [ldapuser]
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   217
    adapter=ldapuser
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   218
    # ldap host
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   219
    host=myhost
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   220
    # base DN to lookup for usres
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   221
    user-base-dn=ou=People,dc=mydomain,dc=fr
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   222
    # user search scope
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   223
    user-scope=ONELEVEL
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   224
    # classes of user
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   225
    user-classes=top,posixAccount
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   226
    # attribute used as login on authentication
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   227
    user-login-attr=uid
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   228
    # name of a group in which ldap users will be by default
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   229
    user-default-group=users
1191
216141cf47a3 remove all erudi and ginco occurences in the doc
Emile Anclin <emile.anclin@logilab.fr>
parents: 383
diff changeset
   230
    # map from ldap user attributes to cubicweb attributes
358
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   231
    user-attrs-map=gecos:email,uid:login
335
643db91242b1 [doc] Integration of card http://intranet.logilab.fr/intra/card/eid/3355 to the book.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 317
diff changeset
   232
358
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   233
  Any change applied to configuration file requires to restart your
e7347a1e3659 [doc] Added a cook book as advised and moved ldap import scripts in the cook book. Started a howto about configuring LDAP but it will have to be reviewed by experts.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 345
diff changeset
   234
  application.
383
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   235
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   236
I get NoSelectableObject exceptions: how do I debug selectors ?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   237
---------------------------------------------------------------
383
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   238
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   239
  You just need to put the appropriate context manager around view/component
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   240
  selection: ::
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   241
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   242
    from cubicweb.common.selectors import traced_selection
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   243
    with traced_selection():
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   244
        comp = self.vreg.select_object('contentnavigation', 'wfhistory',
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   245
                                       self.req, rset, context='navcontentbottom')
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   246
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   247
  This will yield additional WARNINGs, like this: ::
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   248
66804d97b919 [FAQ] debugging selectors : a new faq entry
Aurelien Campeas <aurelien.campeas@logilab.fr>
parents: 358
diff changeset
   249
    2009-01-09 16:43:52 - (cubicweb.selectors) WARNING: selector one_line_rset returned 0 for <class 'cubicweb.web.views.basecomponents.WFHistoryVComponent'>
1354
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   250
1677
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   251
How to format an entity date attribute?
35861bfca748 [doc] Change structure to make it more readable.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1440
diff changeset
   252
---------------------------------------
1354
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   253
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   254
  If your schema has an attribute of type Date or Datetime, you might
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   255
  want to format it. First, you should define your preferred format using
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   256
  the site configuration panel ``http://appurl/view?vid=systemepropertiesform``
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   257
  and then set ``ui.date`` and/or ``ui.datetime``.
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   258
  Then in the view code, use::
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   259
    
e71f704aaf40 [doc] Adds HowTo format date.
Sandrine Ribeau <sandrine.ribeau@logilab.fr>
parents: 1350
diff changeset
   260
    self.format_date(entity.date_attribute)