doc/4.0.rst
changeset 9113 af6efc15fc90
parent 9043 97c3bb9a7c99
child 9115 fcc732a9d9ac
equal deleted inserted replaced
9112:c859c7cef346 9113:af6efc15fc90
     6 
     6 
     7 * The anonymous property of Session and Connection are now computed from the
     7 * The anonymous property of Session and Connection are now computed from the
     8   related user login. If it match the ``anonymous-user`` in the config the
     8   related user login. If it match the ``anonymous-user`` in the config the
     9   connection is anonymous. Beware that the ``anonymous-user`` config is web
     9   connection is anonymous. Beware that the ``anonymous-user`` config is web
    10   specific. Therefore, no session may be anonymous in repository only setup.
    10   specific. Therefore, no session may be anonymous in repository only setup.
       
    11 
       
    12 New Repository Access API
       
    13 -------------------------
       
    14 
       
    15 Connection replace Session
       
    16 ~~~~~~~~~~~~~~~~~~~~~~~~~~
       
    17 
       
    18 A new explicite Connection object replace Session as the main repository entry
       
    19 point. Connection hold all the necessary methods to be used Server side
       
    20 (``execute``, ``commit``, ``rollback``, ``call_service``, ``entity_from_eid``,
       
    21 etc…). You obtains a new Connection object using ``session.new_cnx()``.
       
    22 Connection object need have an explicite begin and end. Use them as a context
       
    23 manager::
       
    24 
       
    25     with session.new_cnx() as cnx:
       
    26         self.execute('INSERT Elephant E, E name "Cabar"')
       
    27         self.commit()
       
    28         self.execute('INSERT Elephant E, E name "Celeste"')
       
    29         self.commit()
       
    30     # Once you get out of the "with" clause, the connection is closed.
       
    31 
       
    32 Using the same Connection object in multiple threads will give you access to the
       
    33 same Transaction. However, Connection object are not thread safe.
       
    34 
       
    35 ``repository.internal_session`` is deprecated in favor of
       
    36 ``repository.internal_cnx``. Note that internal connection are now safe by
       
    37 default. Integrity hooks are enabled except stated otherwise.
       
    38 
       
    39 Backward compact is preserved on Session. They can still be used to access the
       
    40 database for the next few version.
       
    41 
    11 
    42 
    12 API changes
    43 API changes
    13 -----------
    44 -----------
    14 
    45 
    15 * ``RepositorySessionManager.postlogin`` is now called with two arguments,
    46 * ``RepositorySessionManager.postlogin`` is now called with two arguments,