[Cubicweb] Incoming refactoring in core cubicweb logic.

Pierre-Yves David pierre-yves.david at logilab.fr
Mon Mar 5 18:29:17 CET 2012

In the process of having a full featured WSGI support for cubicweb I'm
refactoring a lot of core code.

Below is a list of commit in final review. You may have a view on some area or
be impacted by such change. Please take a look and express your opinion before
this get final approval and published.

This is a quick summary of changes. Have a look to related ticked and patches
for details.

[twisted] move out url logic from twisted (closes #2200593)

    Implements static files serving as cw controller instead of twisted resource.
    This prevent the need to reimplement them with other back-end (WSGI) but
    probably have a performance impact.

[request] gather all base_url logic in a single place (closes #2200756)


    (1) web handler (aka: twisted) where overwriting the base_url config
    when https setup where detected

    (2) code that need promoting to https forged an https url from an http one
    using ``<some-url>.replace('http://', 'https://')``


    A. the ``base_url`` method automatically detect if the request is secure
       and use the config option accordingly. 

    B. To explicitly request the use of a secure url a ``secure`` argument is
       available on. The ``base_url`` method.

    C. repo side the ``https-url`` option does not exists. the insecure url is
       always used. If the ``secure`` argument is used a NotImplementedError is

    D. ``build_url`` gain a __secure__ argument to generate secure url.

    In the future we will probably want to change the way we handle http vs
    https at a config level. But this is outside the scope of this ticket. This
    ticket focus on: (1) limit reimplementation of the base_url method. (2)
    prevent replace hack for https promotions.

[LoginForm] refactor to ease other implementation

    Just of matter of moving generic element in an ABC to ease reimplementation
    by other cubes. This ease migration from the next changeset

[login] split authentication logic from post authentication logic (closes #2200755)

    Major change here!


    * the login forms where submitted to "the page you are trying to
      look at"


    * the login forms will always be submitted to <base-url>/login

    * after succesful login you will be redirected to a page you where trying to
      acces. the path of this path will be transmitted in an GET argument.

    * The log out first message have disappeared 

    * The authentication mechanism is only responsible for authentication.
      The login controller are in charge of the redirection.

[web] Move request handling logic into cubicweb application. (closes #2200684)


    * Most of the http logic was handled by code specific to the
      twisted server.


    * most of this code is handle by the generic web/application,

    * the handling of http return code have been highly improved,

    * the various pass in http processing and error handling are now clearer.

[Web-Request] Use rich header (closes #2204164)

    * rich http header imported from twisted are used for any web request now.

looping task: move looping task logic in a dedicated object (progress #2204047)
repository: split repo initialization from starting looping task (closes #2204047)

    * this start the process of removing task management from the repository.
      This ultimate goal is to have the Repository class only in charge of RQL

repository: move task manager instantiation outside repository.

    * Keep going on the process. The TaskManager is created and "managed" by
      code which create the repository. TaskManager is not provided at all in
      several case where looping tasks were disabled in practice


The next move toward WSGI will be to refactor the way repository are instantiate and
accessed client side.  Currently, the WebConfiguration class is in charge of creating and
giving access to the repository used by the client. This prevent flexible
instantiation of the repository.

Pierre-Yves David


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20120305/168a15ce/attachment-0270.sig>

More information about the Cubicweb mailing list