doc/book/en/annexes/faq.rst
branchstable
changeset 2172 cf8f9180e63e
parent 2041 296e897ab8e1
child 2173 7fae9300b9f9
equal deleted inserted replaced
2125:19861294506f 2172:cf8f9180e63e
   122 
   122 
   123     class version_of(RelationType):
   123     class version_of(RelationType):
   124         """link a version to its project. A version is necessarily linked
   124         """link a version to its project. A version is necessarily linked
   125         to one and only one project. """
   125         to one and only one project. """
   126         # some lines voluntarily missing
   126         # some lines voluntarily missing
   127         permissions = {'read': ('managers', 'users', 'guests',), 
   127         permissions = {'read': ('managers', 'users', 'guests',),
   128                        'delete': ('managers', ),
   128                        'delete': ('managers', ),
   129                        'add': ('managers', 'logilab',
   129                        'add': ('managers', 'logilab',
   130                             RRQLExpression('O require_permission P, P name "add_version",
   130                             RRQLExpression('O require_permission P, P name "add_version",
   131                             'U in_group G, P require_group G'),) }
   131                             'U in_group G, P require_group G'),) }
   132 
   132 
   183 How to update a database after a schema modification?
   183 How to update a database after a schema modification?
   184 -----------------------------------------------------
   184 -----------------------------------------------------
   185 
   185 
   186   It depends on what has been modified in the schema.
   186   It depends on what has been modified in the schema.
   187 
   187 
   188   * Update of an attribute permissions and properties: 
   188   * Update of an attribute permissions and properties:
   189     ``synchronize_eschema('MyEntity')``.
   189     ``synchronize_eschema('MyEntity')``.
   190 
   190 
   191   * Update of a relation permissions and properties: 
   191   * Update of a relation permissions and properties:
   192     ``synchronize_rschema('MyRelation')``.
   192     ``synchronize_rschema('MyRelation')``.
   193 
   193 
   194   * Add an attribute: ``add_attribute('MyEntityType', 'myattr')``.
   194   * Add an attribute: ``add_attribute('MyEntityType', 'myattr')``.
   195 
   195 
   196   * Add a relation: ``add_relation_definition('SubjRelation', 'MyRelation', 'ObjRelation')``.
   196   * Add a relation: ``add_relation_definition('SubjRelation', 'MyRelation', 'ObjRelation')``.
   302   If your schema has an attribute of type Date or Datetime, you might
   302   If your schema has an attribute of type Date or Datetime, you might
   303   want to format it. First, you should define your preferred format using
   303   want to format it. First, you should define your preferred format using
   304   the site configuration panel ``http://appurl/view?vid=systempropertiesform``
   304   the site configuration panel ``http://appurl/view?vid=systempropertiesform``
   305   and then set ``ui.date`` and/or ``ui.datetime``.
   305   and then set ``ui.date`` and/or ``ui.datetime``.
   306   Then in the view code, use::
   306   Then in the view code, use::
   307     
   307 
   308     self.format_date(entity.date_attribute)
   308     self.format_date(entity.date_attribute)
   309 
   309 
   310 Can PostgreSQL and CubicWeb authentication work with kerberos ?
   310 Can PostgreSQL and CubicWeb authentication work with kerberos ?
   311 ----------------------------------------------------------------
   311 ----------------------------------------------------------------
   312 
   312 
   313   If you have postgresql set up to accept kerberos authentication, you can set
   313   If you have postgresql set up to accept kerberos authentication, you can set
   314   the db-host, db-name and db-user parameters in the `sources` configuration
   314   the db-host, db-name and db-user parameters in the `sources` configuration
   315   file while leaving the password blank. It should be enough for your instance
   315   file while leaving the password blank. It should be enough for your instance
   316   to connect to postgresql with a kerberos ticket.
   316   to connect to postgresql with a kerberos ticket.
   317 
   317 
   318   
   318 
   319 How to load data from a script?
   319 How to load data from a script?
   320 -------------------------------
   320 -------------------------------
   321 
   321 
   322   The following script aims at loading data within a script assuming pyro-nsd is
   322   The following script aims at loading data within a script assuming pyro-nsd is
   323   running and your application is configured with ``pyro-server=yes``, otherwise
   323   running and your application is configured with ``pyro-server=yes``, otherwise
   355 
   355 
   356     $ python
   356     $ python
   357     >>> from cubicweb.server.utils import crypt_password
   357     >>> from cubicweb.server.utils import crypt_password
   358     >>> crypt_password('joepass')
   358     >>> crypt_password('joepass')
   359     'qHO8282QN5Utg'
   359     'qHO8282QN5Utg'
   360     >>> 
   360     >>>
   361 
   361 
   362   and paste it in the database::
   362   and paste it in the database::
   363 
   363 
   364     $ psql mydb
   364     $ psql mydb
   365     mydb=> update cw_cwuser set cw_upassword='qHO8282QN5Utg' where cw_login='joe';
   365     mydb=> update cw_cwuser set cw_upassword='qHO8282QN5Utg' where cw_login='joe';