Starting from CubicWeb version 4.0 all code related to generating html views has been moved to the Cube cubicweb_web.

If you want to migrate a project from 3.38 to 4.* while still using all the html views you need to both install the cubicweb_web cube AND add it to your dependencies and run add_cube('web').

cubicweb_web can be installed from pypi this way:

pip install cubicweb_web

We don’t plan to maintain the features in cubicweb_web in the long run; we are moving to a full javascript frontend using both cubicweb_api (which exposes a HTTP API) and @cubicweb/client as a frontend javascript toolkit.

In the long run cubicweb_api will be merged inside of CubicWeb.

HTTP cache management#

HTTP cache managers

Cache policies#

class cubicweb_web.httpcache.NoHTTPCacheManager(view)[source]#

default cache manager: set no-cache cache control policy

class cubicweb_web.httpcache.MaxAgeHTTPCacheManager(view)[source]#

max-age cache manager: set max-age cache control policy, with max-age specified with the cache_max_age attribute of the view

class cubicweb_web.httpcache.EtagHTTPCacheManager(view)[source]#

etag based cache manager for startup views

  • etag is generated using the view name and the user’s groups

  • set policy to ‘must-revalidate’ and expires to the current time to force revalidation on each request

class cubicweb_web.httpcache.EntityHTTPCacheManager(view)[source]#

etag based cache manager for view displaying a single entity

  • etag is generated using entity’s eid, the view name and the user’s groups

  • get last modified time from the entity definition (this may not be the entity’s modification time since a view may include some related entities with a modification time to consider) using the last_modified method


exception cubicweb_web.httpcache.NoEtag[source]#

an etag can’t be generated

Helper functions#