[Cubicweb] UI configuration : evolution proposal
fcayre at logilab.fr
Wed Jul 18 18:02:10 CEST 2012
as can be seen in this ticket <https://www.cubicweb.org/ticket/2406609>,
I would like to be able to use the powerful uicfg
more widely to configure my user interfaces.
The problem to me is that the configurations (be it for forms, primary
views, a.s.o) apply site-wide. You just can't hide one field of a form
to a user and show it to the site managers using uicfg. Same with
primary view parts.
The way I tried to solve this problem is putting ui configuration
instances into a dedicated registry and make them selectable. Then I
turned direct imports from the default configuration into selection in
this registry and that was it.
If you have another idea to implement this, please share. This email is
precisely aimed at getting feedback on this solution and choose another
approach if anyone in the CW community has a better plan.
To give you a better idea, here is the kind of code you will need to
write once the corresponding patch
<https://www.cubicweb.org/patch/2398503> applied (note it depends on
this one <http://www.logilab.org/patch/98633> in logilab.common) to
build a new configuration instance:
from cubicweb.web import uicfg
__select__ = uicfg.AutoformSectionRelationTags.__select__ &
my_cube_users_afs = MyCubeUserAfs()
from my_cube.uicfg import my_cube_users_afs
'MyInstanceType2'), 'main', 'hidden')
The reason for splitting this into two files is for automatic reloading
in debug mode : you will be able to edit your configuration rules in
debug mode without restarting your server (however if you edit
my_cube/uicfg.py, you will have to restart).
functions have been added an optional configuration instance as a
parameter, but should probably become methods of the configuration
Waiting for you feedback,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Cubicweb