[Cubicweb] cubicweb.web.views.basetemplates.HTMLPageHeader

Aurélien Campéas aurelien.campeas at logilab.fr
Mon Jul 6 17:38:06 CEST 2009


On Mon, Jul 06, 2009 at 10:14:08AM -0500, Carlos Balderas wrote:
> Thank you, it worked perfect.
> 
> Regards
> Carlos
> 
> On Mon, Jul 6, 2009 at 10:03 AM, Aurélien Campéas <aurelien.campeas at logilab.fr>
> wrote:
> 
>     On Mon, Jul 06, 2009 at 09:53:52AM -0500, Carlos Balderas wrote:
>     > Salut,
> 
>     Salut,
> 
>     >
>     > I am trying to modify the HTMLPageHeader of the main template but I am
>     getting
>     > an error:
>     >
>     > (cubicweb.registry) ERROR: select ambiguity, args:
>     > (<cubicweb.etwist.request.CubicWebTwistedRequestAdapter object at
>     0xb3e3d4c>,
>     > None)
>     > kwargs: ['w', 'view'] ["<class
>     > 'cubicweb.web.views.basetemplates.HTMLPageHeader'>", "<class
>     > 'cubes.alltests.views.maintemplates.MyHTMLPageHeader'>"]
> 
>     Yes, cubicweb does not know how to choose between the two
>     implementations ... So you have to tell it. At the end of the module
>     that redefines your html header, add the following :
> 
>     def registration_callback(vreg):
>        vreg.register_and_replace(MyHTMLPageHeader, HTMLPageHeader)
> 
> 
>     Having this function there immediately tells cw not to automatically
>     register
>     stuff. Instead it executes it (with the vregistry as argument).
> 

A small additional note : cw can't decide between the two because they
have equal 'selector value'. Another way to disambigüate (esp. useful
if you want to keep both version around) is to specialize the new
view/template/... on more specific conditions (adding to the
__select__ class attribute).

But in your case I suspect you just wanted to override one template
with another, so the registration callback is the right thig to do.



More information about the Cubicweb mailing list