On 4/12/13, Andrej Golcov <[email protected]> wrote: >> Like I said in a message sent to [email protected] (<= >> citation missing) if I had to choose among an architecture that would >> have to be changed every time a new event type is needed and another >> more stable in time I'd rather choose the later . Practicality beats >> purity . There are no such things like aspects in Trac . > [...] > For example, let's assume a component that listens to > changed events for Ticket and Version entities. In more generic > approach the code could look like: > {{{ > class MultipleEntitiesEventsConsumer(Component): > implements(IEventListener) > > #components some how define that it wants receive change events for > Ticket and Version > > def event(event_name, entity, event_args): > if event_name == "created": > if isinstance(Ticket, entity): > self.ticket_created(entity, event_args["context"]) > if isinstance(Version, entity): > self.version_created(entity, event_args["context"]) > elif event_name == "changed": > ...
Not necessarily ... > #you've got the point > ... I do understand what you mean > def ticket_created(self, entity, context): > pass > > def version_created(self, entity, context): > pass > }}} > [...] -- Regards, Olemis. -- You received this message because you are subscribed to the Google Groups "Trac Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/trac-dev?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
