author | Christophe de Vienne <christophe@unlish.com> |
Mon, 22 Sep 2014 09:40:43 +0200 | |
changeset 11512 | bb548010b390 |
parent 11495 | f936708c6ea2 |
permissions | -rw-r--r-- |
11480
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
1 |
Next steps |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
2 |
---------- |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
3 |
|
11491
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
4 |
- finish what was started : |
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
5 |
|
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
6 |
- bypass publisher. |
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
7 |
- tighten the error handling and get a well-behaved application |
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
8 |
- provide sane default policies that match current cubicweb behavior. |
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
9 |
|
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
10 |
- identify what can be done without pushing the 'pyramid way' into cubicweb (as |
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
11 |
a first step for future evolutions). |
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
12 |
|
6ba31f0c7d5a
Update the TODO list
Christophe de Vienne <christophe@unlish.com>
parents:
11480
diff
changeset
|
13 |
|
11480
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
14 |
Provide a ctl command |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
15 |
~~~~~~~~~~~~~~~~~~~~~ |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
16 |
|
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
17 |
Add a 'pyramid' command for cubicweb-ctl that starts a cubicweb instance within |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
18 |
a pyramid container. |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
19 |
|
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
20 |
Transactions |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
21 |
~~~~~~~~~~~~ |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
22 |
|
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
23 |
A common transaction handling mechanism should be used so that the connexion |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
24 |
can be safely used in both pyramid and cubicweb. |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
25 |
|
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
26 |
Reimplement the base controllers of cw |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
27 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
28 |
|
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
29 |
- rest |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
30 |
- static |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
31 |
- data |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
32 |
|
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
33 |
Bypass cw.handle_request in most case |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
34 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
35 |
|
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
36 |
Use it only when no other mean works, which should provide backward compat of |
79ac26923432
Initial implementation
Christophe de Vienne <christophe@unlish.com>
parents:
diff
changeset
|
37 |
old cubes for a while. |
11495
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
38 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
39 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
40 |
Views |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
41 |
----- |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
42 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
43 |
Goal: Have Cubicweb Views selected by pyramid. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
44 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
45 |
The selection behavior should be consistent with the cw predicates weight based |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
46 |
priority system. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
47 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
48 |
Several approaches should be studied, some less integrated than others. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
49 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
50 |
Use a ViewMapper |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
51 |
~~~~~~~~~~~~~~~~ |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
52 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
53 |
Here, the idea is to register a single pseudo view for each view __regid__ |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
54 |
present in the CW registry. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
55 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
56 |
The view mapper associated with these pseudo views would do a view lookup on |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
57 |
the CW registry first, then call it for rendering. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
58 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
59 |
Pros |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
60 |
* Easy to implement |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
61 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
62 |
Cons |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
63 |
* Need to keep two registries in the long term |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
64 |
* Two phases lookup: once in pyramid, once in CW. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
65 |
* A lookup is performed when pyramid assumes it is finished and |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
66 |
successful, which means we do not respect the pyramid API (A |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
67 |
ViewMapper is just supposed to render an already selected view) |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
68 |
* CW views are not registered directly by pyramid |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
69 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
70 |
I (Christophe) don't like this solution because it is too much of a workaround |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
71 |
and we would not use the pyramid API, just wrapping stuffs. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
72 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
73 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
74 |
Use a custom IMultiView |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
75 |
~~~~~~~~~~~~~~~~~~~~~~~ |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
76 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
77 |
Implements a IMultiView (see pyramid.config.views.MultiView) that lookups in |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
78 |
the CW registry in hits __discriminator__. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
79 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
80 |
One instance of this class would be registered for each __regid__, like with |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
81 |
the ViewMapper-based solution. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
82 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
83 |
Pros |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
84 |
* Not too difficult to implement |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
85 |
* Respect more the pyramid API: the lookup is performed at a moment it is |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
86 |
expected by pyramid. In the end, pyramid will know the right view, and |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
87 |
any other system looking up for a view will find an actual one, not a |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
88 |
pseudo one. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
89 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
90 |
Cons |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
91 |
* The CW views are not registered directly in pyramid |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
92 |
* Still doing two lookups in two different registries. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
93 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
94 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
95 |
Use CW predicates in add_view (basic) |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
96 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
97 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
98 |
Here we add a "cwselect" predicate to pyramid, that makes it able to evaluate |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
99 |
the cubicweb predicates. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
100 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
101 |
Pros |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
102 |
* We by-pass the CW registry |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
103 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
104 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
105 |
Cons |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
106 |
* We loose the cw predicate weigths |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
107 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
108 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
109 |
Use CW predicates in add_view + total ordering |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
110 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
111 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
112 |
Here we choose to drop the runtime evaluation of the predicates weight. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
113 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
114 |
Instead, we evaluate the weight of a predicate when it matches, and use that to |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
115 |
sort the views in the registry. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
116 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
117 |
This would need only a slight change of the pyramid MultiView, which would sort |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
118 |
the views in this new order we compute instead of the default one. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
119 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
120 |
To use this system, we would need to duplicate the view registering when the |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
121 |
expression has some "or" operators in it. The idea is to obtain 'and-only' |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
122 |
predicate expressions for add_view. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
123 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
124 |
The only blocking point against that would be if some actual cw predicates |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
125 |
returns a variable weight depending on the context, because it would make it |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
126 |
impossible to pre-evaluate an expression weight if it matches. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
127 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
128 |
Use CW predicates in add_view + cw predicate weight |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
129 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
130 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
131 |
Add runtine evalution of predicate weigths into pyramid. |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
132 |
|
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
133 |
No real clue on how we can to that (yet), although it will most probably |
f936708c6ea2
Document the view problem hypothesis.
Christophe de Vienne <christophe@unlish.com>
parents:
11491
diff
changeset
|
134 |
involve changes in MultiView. |