blog entries created by Aurelien Campeas
- implement Cross Origin Resource Sharing (CORS)
- system_source.create_eid can return a range of IDs, to reduce overhead of batch
- The anonymous property of Session and Connection is now computed from the
related user login. If it matches the anonymous-user in the config the
connection is anonymous. Beware that the anonymous-user config is web
specific. Therefore, no session may be anonymous in a repository only setup.
A new explicit Connection object replaces Session as the main repository entry
point. A Connection holds all the necessary methods to be used server-side
(execute, commit, rollback, call_service, entity_from_eid,
etc...). One obtains a new Connection object using session.new_cnx().
Connection objects need to have an explicit begin and end. Use them as a context
manager to never miss an end:
with session.new_cnx() as cnx:
cnx.execute('INSERT Elephant E, E name "Babar"')
cnx.execute('INSERT Elephant E, E name "Celeste"')
# Once you get out of the "with" clause, the connection is closed.
Using the same Connection object in multiple threads will give you access to the
same Transaction. However, Connection objects are not thread safe (hence at your
repository.internal_session is deprecated in favor of
repository.internal_cnx. Note that internal connections are now safe by default,
i.e. the integrity hooks are enabled.
Backward compatibility is preserved on Session.
A new API has been introduced to replace the dbapi. It is called repoapi.
There are three relevant functions for now:
- repoapi.get_repository returns a Repository object either from an
URI when used as repoapi.get_repository(uri) or from a config
when used as repoapi.get_repository(config=config).
- repoapi.connect(repo, login, **credentials) returns a ClientConnection
associated with the user identified by the credentials. The
ClientConnection is associated with its own Session that is closed
when the ClientConnection is closed. A ClientConnection is a
Connection-like object to be used client side.
- repoapi.anonymous_cnx(repo) returns a ClientConnection associated
with the anonymous user if described in the config.
On the client/web side, the Request is now using a repoapi.ClientConnection
instead of a dbapi.Connection. The ClientConnection has multiple backward
compatible methods to make it look like a dbapi.Cursor and dbapi.Connection.
Sessions used on the Web side are now the same as the ones used Server side.
Some backward compatibility methods have been installed on the server side Session
to ease the transition.
The authentication stack has been altered to use the repoapi instead of
the dbapi. Cubes adding new elements to this stack are likely to break.
All current methods and attributes used to access the repo on CubicWebTC are
deprecated. You may now use a RepoAccess object. A RepoAccess object is
linked to a new Session for a specified user. It is able to create
Connection, ClientConnection and web side requests linked to this
access = self.new_access('babar') # create a new RepoAccess for user babar
with access.repo_cnx() as cnx:
# some work with server side cnx
with access.client_cnx() as cnx:
# some work with client side cnx
with access.web_request(elephant='babar') as req:
# some work with web request
elephant_name = req.form['elephant']
By default testcase.admin_access contains a RepoAccess object for the
default admin session.
- RepositorySessionManager.postlogin is now called with two arguments,
request and session. And this now happens before the session is linked to the
- SessionManager and AuthenticationManager now take a repo object at
initialization time instead of a vreg.
- The async argument of _cw.call_service has been dropped. All calls are
now synchronous. The zmq notification bus looks like a good replacement for
most async use cases.
- repo.stats() is now deprecated. The same information is available through
a service (_cw.call_service('repo_stats')).
- repo.gc_stats() is now deprecated. The same information is available through
a service (_cw.call_service('repo_gc_stats')).
- repo.register_user() is now deprecated. The functionality is now
available through a service (_cw.call_service('register_user')).
- request.set_session no longer takes an optional user argument.
- CubicwebTC does not have repo and cnx as class attributes anymore. They are
standard instance attributes. set_cnx and _init_repo class methods
become instance methods.
- set_cnxset and free_cnxset are deprecated. The database connection
acquisition and release cycle is now more transparent.
- The implementation of cascading deletion when deleting composite
entities has changed. There comes a semantic change: merely deleting
a composite relation does not entail any more the deletion of the
component side of the relation.
- _cw.user_callback and _cw.user_rql_callback are deprecated. Users
are encouraged to write an actual controller (e.g. using ajaxfunc)
instead of storing a closure in the session data.
- A new entity.cw_linkable_rql method provides the rql to fetch all entities
that are already or may be related to the current entity using the given
- The session.hijack_user mechanism has been dropped.
- EtypeRestrictionComponent has been removed, its functionality has been
replaced by facets a while ago.
- the old multi-source support has been removed. Only copy-based sources
remain, such as datafeed or ldapfeed.
The migration script does not handle sqlite nor mysql instances.
- add a security debugging tool
- introduce an add permission on attributes, to be interpreted at
entity creation time only and allow the implementation of complex
update rules that don't block entity creation (before that the
update attribute permission was interpreted at entity creation and
update time) (see #2965518)
- the primary view display controller (uicfg) now has a
set_fields_order method similar to the one available for forms
- new method ResultSet.one(col=0) to retrieve a single entity and enforce the
result has only one row (see #3352314)
- new method RequestSessionBase.find to look for entities
- the embedded jQuery copy has been updated to version 1.10.2, and jQuery UI to
- initial support for wsgi for the debug mode, available through the new
wsgi cubicweb-ctl command, which can use either python's builtin
wsgi server or the werkzeug module if present.
- a rql-table directive is now available in ReST fields
- cubicweb-ctl upgrade can now generate the static data resource directory
directly, without a manual call to gen-static-datadir.
- not really an API change, but the entity write permission checks are now
systematically deferred to an operation, instead of a) trying in a
hook and b) if it failed, retrying later in an operation
- The default value storage for attributes is no longer String, but
Bytes. This opens the road to storing arbitrary python objects, e.g.
numpy arrays, and fixes a bug where default values whose truth value
was False were not properly migrated.
- symmetric relations are no more handled by an rql rewrite but are
now handled with hooks (from the activeintegrity category); this
may have some consequences for applications that do low-level database
manipulations or at times disable (some) hooks.
- unique together constraints (multi-columns unicity constraints)
get a name attribute that maps the CubicWeb contraint entities to the
corresponding backend index.
- BreadCrumbEntityVComponent's open_breadcrumbs method now includes
the first breadcrumbs separator
- entities can be compared for equality and hashed
- the on_fire_transition predicate accepts a sequence of possible
- the GROUP_CONCAT rql aggregate function no longer repeats duplicate
values, on the sqlite and postgresql backends
- pyrorql sources have been deprecated. Multisource will be fully dropped
in the next version. If you are still using pyrorql, switch to datafeed
- the old multi-source system
- find_one_entity and find_entities in favor of find
- the TmpFileViewMixin and TmpPngView classes (see #3400448)
- ldapuser have been dropped; use ldapfeed now
- action GotRhythm was removed, make sure you do not
import it in your cubes (even to unregister it)
- all 3.8 backward compat is gone
- the twisted (web-only) instance type has been removed
For a complete list of tickets, read CubicWeb 3.18.0.
What's new in CubicWeb 3.17?
- add a command to compare db schema and file system schema
- Add CubicWebRequestBase.content with the content of the HTTP request
- Add directive bookmark to ReST rendering
- Allow user defined final type
- drop typed_eid() in favour of int() (see #2742462)
- The SIOC views and adapters have been removed from CubicWeb and moved to the
- The web page embedding views and adapters have been removed from CubicWeb and
moved to the embed cube.
- The email sending views and controllers have been removed from CubicWeb and
moved to the massmailing cube.
- RenderAndSendNotificationView is deprecated in favor of
ActualNotificationOp the new operation uses the more efficient data
- Looping task can now have an interval <= 0. Negative interval disable the
looping task entirely.
- We now serve html instead of xhtml.
- ldapuser has been deprecated. It will be removed in a future
version. If you are still using ldapuser switch to ldapfeed NOW!
- hijack_user has been deprecated. It will be dropped soon.
- The progress views and adapters have been removed from CubicWeb. These
classes were deprecated since 3.14.0. They are still available in the
- The part of the API deprecated since 3.7 was dropped.
What's new in CubicWeb 3.16?
- Add a new dataimport store (SQLGenObjectStore). This store enables a fast
import of data (entity creation, link creation) in CubicWeb, by directly
flushing information in SQL. This may only be used with PostgreSQL, as it
requires the 'COPY FROM' command.
Orm: set_attributes and set_relations are unified (and
deprecated) in favor of cw_set that works in all cases.
db-api/configuration: all the external repository connection information is
now in an URL (see #2521848),
allowing to drop specific options of pyro nameserver host, group, etc and fix
broken ZMQ source. Configuration related changes:
- Dropped 'pyro-ns-host', 'pyro-instance-id', 'pyro-ns-group' from the client side
configuration, in favor of 'repository-uri'. NO MIGRATION IS DONE,
supposing there is no web-only configuration in the wild.
- Stop discovering the connection method through repo_method class attribute
of the configuration, varying according to the configuration class. This is
a first step on the way to a simpler configuration handling.
DB-API related changes:
- Stop indicating the connection method using ConnectionProperties.
- Drop _cnxtype attribute from Connection and cnxtype from
Session. The former is replaced by a is_repo_in_memory property
and the later is totaly useless.
- Turn repo_connect into _repo_connect to mark it as a private function.
- Deprecate in_memory_cnx which becomes useless, use _repo_connect instead
the "tcp://" uri scheme used for ZMQ
communications (in a way reminiscent of Pyro) is now named
"zmqpickle-tcp://", so as to make room for future zmq-based lightweight
communications (without python objects pickling).
Request.base_url gets a secure=True optional parameter that yields
an https url if possible, allowing hook-generated content to send
secure urls (e.g. when sending mail notifications)
Dataimport ucsvreader gets a new boolean ignore_errors
- Drop of cubicweb.web.uicfg.AutoformSectionRelationTags.bw_tag_map,
deprecated since 3.6.
- The RQL search bar has now some auto-completion support. It means
relation types or entity types can be suggested while typing. It is
an awesome improvement over the current behaviour !
- The action box associated with table views (from tableview.py)
has been transformed into a nice-looking series of small tabs; it
means that the possible actions are immediately visible and need not
be discovered by clicking on an almost invisible icon on the upper
- The uicfg module has moved to web/views/ and ui configuration
objects are now selectable. This will reduce the amount of
subclassing and whole methods replacement usually needed to
customize the ui behaviour in many cases.
- Remove changelog view, as neither cubicweb nor known cubes/applications
were properly feeding related files.
- 'pyrorql' sources will be automatically updated to use an URL to locate the source
rather than configuration option. 'zmqrql' sources were broken before this change,
so no upgrade is needed...
- Debugging filters for Hooks and Operations have been added.
- Some cubicweb-ctl commands used to show the output of msgcat and
msgfmt; they don't anymore.
As part of an effort to improve the documentation (see the cw_course version) a lot of chapters have been completed (and filled with real-world examples). Many more were updated and reorganized.
I won't list everything but here are the most important improvements:
- The publishing process
- Templates & the architecture of views
- Primary views customizations (including use of the uicfg module)
- Hooks & Operations
- Proper usage of the ORM
- Unit tests
- URL rewrite
Last but not least, a whole new tutorial based on Sylvain's great
series Building my photos Web site has been included. It covers
some advanced topics such as Operations and sophisticated security
The visual style has been enhanced a bit to have better readability.
As always, patches are welcome !
picture under Creative Commons, courtesy of digitalnoise
Cubicweb has experienced a rather large shakeup. Some things needed
major restructuration, and that is why you have been left with few
releases in the past few weeks. All the cubes available at
http://www.cubicweb.org/project have been updated accordingly.
Version 3.2 brings us considerable improvements for:
Cubicweb has had for long a nice system of forms smart enough to build
themselves out of one cube's schema and some programmer-provided hints
(or 'relation tags') to fine-tune things.
It was not easy however to customize these forms nor to build new ones
So the new form systems draws from django-forms flexibility and style,
keeping all the automatic goodness, and also make it quite easy now to
build or customize forms at will.
This is the area were backwards compatibility is mostly gone. Custom
forms will have to be rewritten. Don't be angry about that, the forms
overhaul was long overdue, and from now it will only move in small
evolutionary, well-mannered steps.
Cubiweb has also had for long a nice mechanism to filter views
applicable to a given result set, the selector system. Various
base classes were provided to hide selectors from the
programmer and it had grown a little messy.
Selectors now have a nicer declarative feeling and the framework does
not try to hide them. Quite the opposite: writing, maintaining and
using selectors is now a breeze, and the base classes are gone. More
is less !
However Cubicweb 3.2 remains backward compatible with the old
selectors. Runtime warnings will help you track these and adapt as you
On the smaller features side, worth mentioning are:
- new RichString attribute type in schema definitions, that simplifies
format and encoding management,
- inline relation edition is now possible (it was formerly limited to
attributes) with 'reledit' view,
- workflow definition has been simplified,
- web/views has been somewhat cleanup up and reorganized,
- automatic registration of app objects can now be switched to manual
mode (no more hairy hard-to-debug registerer mechanism),
- a generic SIOC view,
- a view synthetizing permissions across a whole app.
We hope you enjoy this release!
The cubicweb development team.
photo by jared under creative commons