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

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


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).

Cheers,
Aurélien.

> 
> what I am doing is just trying to remove the login of this section :
> 
> ###############################################################################
> ######
> from cubicweb.web.views.basetemplates import HTMLPageHeader
> 
> class MyHTMLPageHeader(HTMLPageHeader):
>    
>     def main_header(self, view):
>         """build the top menu with authentification info and the rql box"""
>         self.w(u'<table id="header"><tr>\n')
>         self.w(u'<td id="firstcolumn">')
>         self.vreg.select_component('logo', self.req, self.rset).dispatch(w=
> self.w)
>         self.w(u'</td>\n')
>         # appliname and breadcrumbs
>         self.w(u'<td id="headtext">')
>         comp = self.vreg.select_component('appliname', self.req, self.rset)
>         if comp and comp.propval('visible'):
>             comp.dispatch(w=self.w)
>         comp = self.vreg.select_component('breadcrumbs', self.req, self.rset,
> view=view)
>         if comp and comp.propval('visible'):
>             comp.dispatch(w=self.w, view=view)
>         self.w(u'</td>')
> 
>         # logged user and help
>         #self.w(u'<td>\n')
>         #comp = self.vreg.select_component('loggeduserlink', self.req,
> self.rset)
>         #comp.dispatch(w=self.w)
>         #self.w(u'</td><td>')
> 
>         # search box
>         self.w(u'<td>')
>         self.get_searchbox(view, 'left')
>         self.w(u'</td>')
> 
>         self.w(u'<td>')
>         helpcomp = self.vreg.select_component('help', self.req, self.rset)
>         if helpcomp: # may not be available if Card is not defined in the
> schema
>             helpcomp.dispatch(w=self.w)
>         self.w(u'</td>')
>         # lastcolumn
>         self.w(u'<td id="lastcolumn">')
>         self.w(u'</td>\n')
>         self.w(u'</tr></table>\n')
>         self.template('logform', rset=self.rset, id='popupLoginBox', klass=
> 'hidden',
>                       title=False, message=False)
> ##############################################################################3
> 
> CubicWeb version: 3.3.2
> Detected mode: installed
> 
> Any help or suggestion to solve this question will be very appreciated.
> 
> Merci Beaucoup
> Carlos Balderas

> _______________________________________________
> Cubicweb mailing list
> Cubicweb at lists.cubicweb.org
> http://lists.cubicweb.org/mailman/listinfo/cubicweb




More information about the Cubicweb mailing list