[Cubicweb] views dont refresh

Nicolas Chauvat nicolas.chauvat at logilab.fr
Sun Aug 2 17:12:15 CEST 2009


On Sun, Aug 02, 2009 at 05:37:31PM +0530, Dhaval Sharma wrote:
> Good, and when you do CTRL+R it refreshes the registery. isn' it?

No. The Shift-Ctrl-R is just for overriding the cache. It has no
effect on the registry.

> Okay, can you throw some light on selector magic and the cell and row game
> that the framework plays?

The views are defined with a __select__ attribute which is a set of
functions that compute a score when given a resultset.

Each time the web engine wants to display a resultset, it looks up the
registry for the views with id <younameit> that could be used for that
resultset. The view with the highest score is the one the web app will
use to display the resultset.

> Briefly how many inbuilt objects does the view carry and what can we do with
> them?

View is the generic term for the classes that will be given a
resultset and expected to generate some output. Output could be HTML,
JSON, XML, PDF, PNG, etc.

You define views and name them with the id attribute and explain what
resultset they can handle with the __select__ attribute.

> Also, let me know when primary and secondary views get invoked and how does
> framework manage actions that are defined for an application?

A primary is meant to display an entity in all its details. By
default, the web engine will use the primary view that fits BlogEntry
when trying to display http://localhost/blogentry/1234.

The term 'secondary view' might disappear in a near future. 

Let's try with 'oneline' view instead.

The oneline view is the one called by default by the web engine for
each element of the resultset when trying to display
http://localhost/blogentry/ which maps to Any B WHERE B is BlogEntry.

> How can I place those actions in say , side boxes or main menu bar?

Not sure what you call main menu.

Side boxes in the default primary view are used to display related
entities. Annotate things with uicfg.primary_view.* to make the
related entities appear or not in these boxes when using the default
primary view.

Boxes in the left column are a different type of beast. You can have a
look at cubes/tracker/views/actions.py for examples. The idea is to
describe an action in the same way you decribe a view (an id to name
it and __select__ to tell when it applies), then register it and let
the web engine display it when it fits with the context.

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  



More information about the Cubicweb mailing list