[Cubicweb] Ticket / IProgressAdapter

Florent Cayré florent at secondweb.fr
Fri Sep 10 09:18:03 CEST 2010


Hi all,

it really sounds like we really should drop trac for CubicWeb here at
SecondWeb.
And write a blog on this ;-)

Regards,
Florent.


2010/9/10 Sylvain Thénault <sylvain.thenault at logilab.fr>

> On 09 septembre 21:42, Carlos Balderas wrote:
> > Hello, list
>
> Hi Carlos,
>
> > 1.- What do you think about making an IProgressAdapter for Ticket entity
> in
> > Tracker cube?
> >      (We find this handy to display progress bar for tickets.)
>
> sounds like a good idea.
>
> > 2.- Would it be so simple like adding these lines in
> > tracker/entities/ticket.py file?
> >
> > 2.1.- Create the IProgressAdapter
> >
> > from cubicweb.entities.adapters import IProgressAdapter
> > from cubicweb.selectors import is_instance
> >
> > class TicketIProgressAdapter(IProgressAdapter):
> >
> >     """IProgressAdapter for Tickets """
> >
> >     __select__ = is_instance('Ticket')
> >
> >     def progress_info(self):
> >
> >         """returns a dictionary describing load and progress of the
> > ticket"""
> >
> >         return {'notestimated': 0,
> >                 'estimated': 0,
> >                 'done': 0,
> >                 'todo': 0 }
> >
> > 2.2.- Add methods to Ticket Entity
> >
> > class Ticket(AnyEntity):
> >     __regid__ = 'Ticket'
> >
> > --------------------- add these 3 methods ---------------------
> >
> >     def done(self):
> >
> >         """returns work done in this ticket """
> >
> >         return self.load - self.load_left
> >
> >     def todo(self):
> >
> >         """returns remaining work in this ticket """
> >
> >         return self.load_left
> >
> >     def revised_cost(self):
> >
> >         """return total work estimated to this ticket """
> >
> >         return self.load
> >
> > Making the changes above, the progress bar view works for tickets too,
> but I
> > am not sure this is the best way to do it.
>
> I don't think that it display valuable information then. The methods you
> added
> on the  ticket entity should be properties of the adapter. Though the base
> adapter provides default implementation for them, based on information
> returned
> by progress info. And you've to implement the in_progress method which is
> also abstract on the base adapter. So something like:
>
> class TicketIProgressAdapter(IProgressAdapter):
>    """IProgressAdapter for Tickets """
>    __select__ = is_instance('Ticket')
>
>    def progress_info(self):
>        """returns a dictionary describing load and progress of the
> ticket"""
>        return {'notestimated': 0,
>                 'estimated': 1,
>                'done': self.entity.load,
>                'todo': self.entity.load - self.entity.load_left}
>
>    def in_progress(self):
>        """returns True if status is not finished"""
>        return self.entity.load_left != 0
>
> should be enough.
>
> --
> Sylvain Thénault                               LOGILAB, Paris (France)
> Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
> Dé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
>



-- 
Ce message est la propriété de SecondWeb et peut contenir des informations
confidentielles. Si vous n'êtes pas le destinataire désigné, nous vous
remercions de bien vouloir nous en aviser immédiatement et de nous retourner
ce message ou de le détruire, sans faire un quelconque usage de son contenu,
ni le communiquer ou le diffuser, ni en prendre copie, électronique ou non.

This message is the property of SecondWeb and may contain confidential
information. If you are not the designated recipient, please notify us
immediately and return the message to us or destroy it, without making any
use whatsoever of the contents thereof. Furthermore you should not forward
or copy the message by electronic or other means.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20100910/dd989826/attachment-0165.html>


More information about the Cubicweb mailing list