Pierre-Yves David <pierre-yves.david@logilab.fr> [Thu, 27 Jun 2013 11:19:28 +0200] rev 9079
[connection] move relation management method
Pierre-Yves David <pierre-yves.david@logilab.fr> [Thu, 27 Jun 2013 11:19:24 +0200] rev 9078
[connection] give access to shared data method
A reference to session data are kept
Pierre-Yves David <pierre-yves.david@logilab.fr> [Thu, 27 Jun 2013 11:19:17 +0200] rev 9077
[connection] move relation cache method to Connection
needed for execute (and need execute themself...)
Pierre-Yves David <pierre-yves.david@logilab.fr> [Wed, 15 May 2013 16:09:31 +0200] rev 9076
[connection] give access to session execute from connection
This allows multiple function that both requires an execute method and are
required by the execute method.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Thu, 23 May 2013 14:17:46 +0200] rev 9075
[connection] move last part of undo logic in connection
Now that Connection have a reference to the repo it can handle all of it itself
Pierre-Yves David <pierre-yves.david@logilab.fr> [Tue, 25 Jun 2013 17:28:41 +0200] rev 9074
[connection] initialize connection.user and connection.lang
A RequestSessionBase need a user and lang. For now we use the session ones.
Later the Connection will have it's own.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 29 Mar 2013 17:43:18 +0100] rev 9073
[Connection] inherit from RequestSessionBase
This contains a lot method. We need them to move more code from Session
to connection.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Wed, 26 Jun 2013 13:48:18 +0200] rev 9072
[multi-sources] drop multi-sources related test.
another branch is removing the multi-source itself. We do not want to bother
fixing those test.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Thu, 27 Jun 2013 18:21:04 +0200] rev 9071
Use new repoapi for the web stack
The publisher now link repoapi.ClientConnection to request. and explicitly
control there scope.
Web side, appobject._cw.cnx is now a repoapi.ClientConnection.
This actually kill webonly possibility until the repoapi is able to use some
RPC.
The change in the authentication stack is very hasty and need cleanup
Pierre-Yves David <pierre-yves.david@logilab.fr> [Tue, 25 Jun 2013 10:59:01 +0200] rev 9070
PARTIAL: Using the repoapi in test
Test now use the repoapi.ClientConnection to access the repo. This is very big
change. The current method to access the repo are kept for backward
compatibility. The new methods will be introduced much later.
The TestCase keep a ClientConnection To an admin session for the whole test.
This changeset does not makes all tests pass without the next one that change
set htt without the next one that change the http stack
Pierre-Yves David <pierre-yves.david@logilab.fr> [Tue, 25 Jun 2013 14:45:16 +0200] rev 9069
[web/test] drop proff of concept Facebook login in test
The authentication stack will change. The change in API will requires rework of
user cube anyway.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Tue, 25 Jun 2013 10:46:35 +0200] rev 9068
[test/dbapi] do not rely on the Testcase provided cnx
We plan to use the repoapi in the test. So we need the DBAPI test to explicitly
create a DBAPI connection.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Tue, 25 Jun 2013 10:45:44 +0200] rev 9067
[dbapi] explicitly use the DBAPI version of CubicwebRequestBase
As we plan to use a ConnectionCubicwebRequestBase by default we better have the
dbapi explicitly asking for a DBAPI implementation.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 18:33:41 +0200] rev 9066
[web/application] drop unused import
unused since 3c85e734ce00
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 18:35:22 +0200] rev 9065
[web/test] properly reset the request connection related attribute
A new request does not have those attribute to None. There have special value
that we now properly reinstall.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 18:23:48 +0200] rev 9064
[web/test] drop two undocumented suspicious regression test
Those two test are not documented and use the API in the wrong way. They do not
raise exception by chance.
the current request signature is::
def request(self, rollbackfirst=False, url=None, headers={}, **kwargs):
So the RQL have nothing to do here.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 19:27:31 +0200] rev 9063
[webrequest] introduce an alternative implementation using the repoapi
DBAPI specific parts of ``CubicWebRequestBase`` are extracted in a
``DBAPICubicWebRequestBase`` decicated class and a new
``ConnectionCubicWebRequestBase`` is introduced that provide the same services
but using a repoapi.ClientConnection as data source. For now the
``DBAPICubicWebRequestBase`` is still used by default.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 18:18:51 +0200] rev 9062
[repoapi] add an anonymous_cnx function
This function return an anonymous ClientConnection. It aims to replace
``dbapi.anonymous_session``.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 16:40:12 +0200] rev 9061
[repoapi] add a connect function
This function takes a repo and authentication information to open a new Session
and return a ClientConnection associated to it.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 17:26:13 +0200] rev 9060
[client-connection] add an auto-close property for ClientConnection
The next commit introduce a connect function that open a new Session and return
an associated ClientConnection. The Session should not be used by anything else
than the created ClientConnection, so we want to close it at the same time than
the ClientConnection. The implementation in this changeset is simplistic. We
probably want to move this notion in the session itself. This be improved once
we have server side Connection
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 12:08:06 +0200] rev 9059
[cwuser] make CWUser callable, returning self for dbapi compatibility
In the dbapi, Connection and Session have a ``user`` method to
generated a user for a request In the repo api, Connection and Session
have a user attribute inherited from SessionRequestBase prototype. This
ugly hack allows to not break user of the user method.
To ease transition from dbapi to repoapi we need the ClientConnection to be as
compatible as possible with the dbapi. Adding this method goes in this
direction.
It'll get deprecated in the deprecation wave that will conclude the repoapi
refactoring.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 15:26:03 +0200] rev 9058
[client-connect] drop rqlst on rset returned client side
The DBAPI used to drop the RQL syntax tree on rset to save bandwidth. We could
stop doing it for In-memory client connection. However keeping the syntax tree
leads to multiple tests failures. So we keep dropping it as the DBAPI always
did.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 15:25:47 +0200] rev 9057
[client-connection] add a repo property for dbapi compatibility
To ease transition from dbapi to repoapi we need the ClientConnection to be as
compatible as possible with the dbapi. Adding this method goes in this
direction.
It'll get deprecated in the deprecation wave that will conclude the repoapi
refactoring.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 13:49:13 +0200] rev 9056
[client-connection] add a connection property for dbapi compatibility
To ease transition from dbapi to repoapi we need the ClientConnection to be as
compatible as possible with the dbapi. Adding this method goes in this
direction.
It'll get deprecated in the deprecation wave that will conclude the repoapi
refactoring.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 13:42:19 +0200] rev 9055
[client-connection] add a sessionid property for dbapi compatibility
To ease transition from dbapi to repoapi we need the ClientConnection to be as
compatible as possible with the dbapi. Adding this method goes in this
direction.
It'll get deprecated in the deprecation wave that will conclude the repoapi
refactoring.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 12:12:58 +0200] rev 9054
[client-connection] add a cursor() method for dbapi compatibility
To ease transition from dbapi to repoapi we need the ClientConnection to be as
compatible as possible with the dbapi. Adding this method goes in this
direction.
It'll get deprecated in the deprecation wave that will conclude the repoapi
refactoring.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 11:39:34 +0200] rev 9053
[client-connection] add a request() method for dbapi compatibility
To ease transition from dbapi to repoapi we need the ClientConnection to be as
compatible as possible with the dbapi. Adding this method goes in this
direction.
It'll get deprecated in the deprecation wave that will conclude the repoapi
refactoring.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Tue, 25 Jun 2013 11:06:57 +0200] rev 9052
[repoapi] introduce a basic ClientConnection class
This is the new official way to access the repo from client side.
It still access Session object directly as the server side connection is not up
yet (and it's not up because it would have no user).
Multiple follow up commit will install compatibility with the DBAPI. This will
ease the migration from dbapi to repoapi.
ClientConnection has no user yet but later commit will use it in the whole Web
stack.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Tue, 25 Jun 2013 17:25:47 +0200] rev 9051
[req] add a _set_user method
RequestSessionBase usally need to recreate a new CWuser appobject linked to
themself. We add it to the base class to avoid multiple redifinition.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 18:00:20 +0200] rev 9050
[server/session] add a login property
session.login is a DBAPISession attribute. Having it on server side session
will helps the rework of the API to access repository. The new schema drop the
concept of DBAPISession and use server side session for the same purpose.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 15:47:01 +0200] rev 9049
[server/session] allow access to session id using sessionid
session.sessionid is a DBAPISession attribute. Having it on server side session
will helps the rework of the API to access repository. The new schema drop the
concept of DBAPISession and use server side session for the same purpose.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 17 Jun 2013 17:27:08 +0200] rev 9048
[server/session] Implement anonymous_session
Now we have a simple rule to compute if a session is anonymous we can implement
the property for server session too. Having it on server side session will helps
the rework of the API to access repository. The new schema drop the concept of
DBAPISession and use server side session for the same purpose.
Related to #2953943
Related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 16:07:45 +0200] rev 9047
[server/session] do not clear session.cnx if unrelated to cnx actually cleared
The cnx parameter may be different from the one actually loaded for the current
thread. This will be possible in future commit when you close a client connection
for example.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 14:55:26 +0200] rev 9046
[dbapi] move ProgrammingError into cubicweb module
A new ``repoapi`` will be introduced as a replacement for the dbapi. It will
need ProgrammingError too.
Related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 17 Jun 2013 15:00:41 +0200] rev 9045
[repoapi] move get_repository function into a new repoapi module
This new module aims to host the function of the new API replacing the old
DBAPI. `get_repository` is still needed hence moved to the new module.
Related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Thu, 20 Jun 2013 16:19:27 +0200] rev 9044
[testlib] gather all repository access logic in one place
Refactoring of the repository access API in test is imminent. We plan to move
from the "old" dbapi to the new repoapi.
Gathering all impacted method in one place help to understand how all those
method interact and help readability for both patch and resulting code.
No code change is done at all in this changeset. The refactoring will code
later.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Thu, 20 Jun 2013 16:00:07 +0200] rev 9043
[testlib] move repo and related attribute back on Instance instead of Class
The repo and cnx was hold by the TestCase class to work as a cache and avoid
recreation of the repo from scratch of each test. However since bad26a22fe29 the
caching is done by the DatabaseHandler object and it is not necessary have a
second layer of cache on the TestCase itself.
We move the repo and cnx attribute back on the TestCase instance itself and make
several class methods instance methods again.
This will helps to change dbapi access in test from dbapi to repoapi.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 14:53:19 +0200] rev 9042
[dbapi] makes anonymous_connection a computed property
The current implementation is a boolean flag set manually by client code after
connection creation. This led to different way to decide a anonymous_connection
should be True (eg. different in the test than in the actual application code).
It should not be client responsibility to set this flag.
``cnx.anonymous_connection`` is now a purely computed property. Connection with user in the
"guests" group are anonymous, the other ain't.
``Session.anonymous_session`` is computed from ``cnx.anonymous_connection`` and get
the updated behavior transparently.
Closes #2953943
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 11:31:47 +0200] rev 9041
[webrequest] simplify set_session code
Thanks to the previous changeset we are assured that session handed to
set_session is full featured one. This allows a simpler code for this method.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Fri, 21 Jun 2013 16:28:16 +0200] rev 9040
[webrequest] set DBAPISession without cnx at initialisation time
Such session are necessary for minimal use of a Request. Setting on by default
allow simplification later linking with a full featured DBAPISession or
equivalent. This was not possible before as all session was tracked by session
manager. They are not tracked anymore since aa709bc6b6c1 and we can safely
create them by default.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 12:41:27 +0200] rev 9039
[testlib] rework request building in init_authentication
The previous code was building a full authenticated request and tried to undo
the authentication afterward. The new code just create a bare Request with no
authenticated session linked yet.
This is much closer of what the actual authentication process does.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 12:39:25 +0200] rev 9038
[request] drop the user argument for set_session
I see no code nor test that use this optional argument. removing it help to
clean the session code. The set_session function will soon be deprecated anyway (at the
same time than the dbapi)
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Wed, 19 Jun 2013 12:00:54 +0200] rev 9037
[web-request] handle default language earlier
We now read language negotiation header at initialisation time (previously done
during ``set_session``). This simplify the set_session code for later reworking.
There is no change in behavior, the user selected language continue to overwrite
the one picked from the header/default when applicable.
related to #2503918
Pierre-Yves David <pierre-yves.david@logilab.fr> [Tue, 18 Jun 2013 15:12:25 +0200] rev 9036
[etwist] pass the repository to the root resource
This is another step toward a cleaner instantiation scheme for the repo.
The http test now pass an already created object to the etwist server instead of
relying on the config cache.
Related to #2249513
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 12:03:37 +0200] rev 9035
[repo] move repo.gc_stats to Service API (closes #2951068)
We currently have a method on the repo that anyone can call. `call_service`
gives a similar thing, modulo:
* can be restricted access to manager only (thanks to selection on services),
* less unrelated code on the repository class,
* no need to fetch a reference to a repo object from the client side
* (`req._cnx.repo` is not an API and config.repository() is on its way out).
The old way to access this information (repo.gc_stats()) is deprecated.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 12:05:35 +0200] rev 9034
[repo] move repo stats to Service (closes #2951067)
We currently add a new method on repo that anyone can call. Call service allows
to reach the same result with:
* Restricted access to manager only (thanks to selection on services),
* Less unrelated code on the repo.
* No need to fetch a reference to a repo object from client side.
`req._cnx.repo` is not an API and config.repository() is on its way out.
The old way to access this information (repo.stats()) is deprecated.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 11:59:45 +0200] rev 9033
[service] drop the asynchronous execution possibility
Call_service was able of both sync and sync execution making the API confusing.
There is not user of the async case. We drop the async argument in favor of
synchronous execution only.
This makes call_service the official API to call server side code from the
client side. This is a remplacement for the usual monkey patching of the repo
object.
The zmq notification bus is a solid alternative for codes that needs to start an
async execution.
Pierre-Yves David <pierre-yves.david@logilab.fr> [Mon, 24 Jun 2013 12:00:03 +0200] rev 9032
[auth] pass `repo` instead of `vreg` to SessionManager and AuthenticationManager
Those object actually need a repo object to connect and create new session
object. They used to retrieve the repo object using
``vreg.config.repository()``. I'm trying to sanitise the initialisation stack
and get ride of ``config.repository()``, a function that mix factory and cache.
Retrieving the vreg from the repo is trivial (``repo.vreg``) so we now pass the
repo object instead of the vreg.