[Cubicweb] Cubicweb Digest, Vol 5, Issue 1

Carlos Balderas carlos.balderas at gmail.com
Tue Jul 7 00:14:47 CEST 2009


Thank you, those tips worked also for changing the Index view of CW.

Carlos

On Mon, Jul 6, 2009 at 10:44 AM, <cubicweb-request at lists.cubicweb.org>wrote:

> Send Cubicweb mailing list submissions to
>        cubicweb at lists.cubicweb.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.cubicweb.org/mailman/listinfo/cubicweb
> or, via email, send a message with subject or body 'help' to
>        cubicweb-request at lists.cubicweb.org
>
> You can reach the person managing the list at
>        cubicweb-owner at lists.cubicweb.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Cubicweb digest..."
>
>
> Today's Topics:
>
>   1. cubicweb.web.views.basetemplates.HTMLPageHeader (Carlos Balderas)
>   2. Re: cubicweb.web.views.basetemplates.HTMLPageHeader
>      (Aur?lien Camp?as)
>   3. Re: cubicweb.web.views.basetemplates.HTMLPageHeader
>      (Carlos Balderas)
>   4. Re: cubicweb.web.views.basetemplates.HTMLPageHeader
>      (Aur?lien Camp?as)
>   5. Re: cubicweb.web.views.basetemplates.HTMLPageHeader
>      (Sylvain Th?nault)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 6 Jul 2009 09:53:52 -0500
> From: Carlos Balderas <carlos.balderas at gmail.com>
> Subject: [Cubicweb] cubicweb.web.views.basetemplates.HTMLPageHeader
> To: cubicweb at lists.cubicweb.org, cubicweb-request at lists.cubicweb.org
> Message-ID:
>        <cafa12b90907060753s436a6fa5k28a2b8508be8d024 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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'>"]
>
> 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
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.cubicweb.org/pipermail/cubicweb/attachments/20090706/318e40d7/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 2
> Date: Mon, 6 Jul 2009 17:03:04 +0200
> From: Aur?lien Camp?as <aurelien.campeas at logilab.fr>
> Subject: Re: [Cubicweb]
>        cubicweb.web.views.basetemplates.HTMLPageHeader
> To: Carlos Balderas <carlos.balderas at gmail.com>
> Cc: cubicweb at lists.cubicweb.org, cubicweb-request at lists.cubicweb.org
> Message-ID: <20090706150304.GH15759 at crater.logilab.fr>
> Content-Type: text/plain; charset=utf-8
>
> 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
>
>
>
> ------------------------------
>
> Message: 3
> Date: Mon, 6 Jul 2009 10:14:08 -0500
> From: Carlos Balderas <carlos.balderas at gmail.com>
> Subject: Re: [Cubicweb]
>        cubicweb.web.views.basetemplates.HTMLPageHeader
> To: Aur?lien Camp?as <aurelien.campeas at logilab.fr>
> Cc: cubicweb at lists.cubicweb.org, cubicweb-request at lists.cubicweb.org
> Message-ID:
>        <cafa12b90907060814m6324b7dam8b75d188c7f90936 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> 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).
> >
> > 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
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://lists.cubicweb.org/pipermail/cubicweb/attachments/20090706/103e0da2/attachment-0001.htm
> >
>
> ------------------------------
>
> Message: 4
> Date: Mon, 6 Jul 2009 17:38:06 +0200
> From: Aur?lien Camp?as <aurelien.campeas at logilab.fr>
> Subject: Re: [Cubicweb]
>        cubicweb.web.views.basetemplates.HTMLPageHeader
> To: Carlos Balderas <carlos.balderas at gmail.com>
> Cc: cubicweb at lists.cubicweb.org, cubicweb-request at lists.cubicweb.org
> Message-ID: <20090706153806.GJ15759 at crater.logilab.fr>
> Content-Type: text/plain; charset=utf-8
>
> 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.
>
>
> ------------------------------
>
> Message: 5
> Date: Mon, 6 Jul 2009 17:44:14 +0200
> From: Sylvain Th?nault <sylvain.thenault at logilab.fr>
> Subject: Re: [Cubicweb]
>        cubicweb.web.views.basetemplates.HTMLPageHeader
> To: Aur?lien Camp?as <auc at logilab.fr>
> Cc: cubicweb at lists.cubicweb.org, Carlos Balderas
>        <carlos.balderas at gmail.com>
> Message-ID: <20090706154414.GD21892 at lupus.logilab.fr>
> Content-Type: text/plain; charset=utf-8
>
> On 06 juillet 17:03, Aur?lien Camp?as 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).
>
> another side effect of adding this is that if you've other classes in the
> same
> module, they won't be registered anymore. The usual trick in this case is:
>
>  def registration_callback(vreg):
>     # register everything in this module byt the MyHTMLPageHeader class
>     vreg.register_all(globals().values(), __name__, (MyHTMLPageHeader,)
>     # register MyHTMLPageHeader by replacing standard HTMLPageHeader
>     vreg.register_and_replace(MyHTMLPageHeader, HTMLPageHeader)
>
> --
> Sylvain Th?nault                               LOGILAB, Paris (France)
> Formations Python, Debian, M?th. Agiles: http://www.logilab.fr/formations
> D?veloppement <http://www.logilab.fr/formations%0AD?veloppement> logiciel
> sur mesure:       http://www.logilab.fr/services
> CubicWeb, the semantic web framework:    http://www.cubicweb.org
>
>
>
> ------------------------------
>
> _______________________________________________
> Cubicweb mailing list
> Cubicweb at lists.cubicweb.org
> http://lists.cubicweb.org/mailman/listinfo/cubicweb
>
>
> End of Cubicweb Digest, Vol 5, Issue 1
> **************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20090706/305fad59/attachment-0047.html>


More information about the Cubicweb mailing list