For what it's worth, I would argue the generative SA query should be more
legible to a TG coder than the ior logic (which, frankly, I'm still a little
iffy on).

On Thu, Jul 3, 2008 at 9:04 AM, Florent Aide <[EMAIL PROTECTED]> wrote:

>
> On Thu, Jul 3, 2008 at 2:48 PM, Christopher Arndt <[EMAIL PROTECTED]>
> wrote:
> >
> > Janzert schrieb:
> >> 1. All the TG related code I found uses something similar to this:
> >>      @property
> >>      def permissions(self):
> >>          p = set()
> >>          for g in self.groups:
> >>              p |= set(g.permissions)
> >>          return p
> >>
> >> 2. Why not something like the following (untested code)?
> >>      @property
> >>      def permissions(self):
> >>          p_q = session.query(Permission).join(['tg_group', 'tg_user'])
> >>          p_q.filter_by(user_id = self.user_id)
> >>       return p_q.all()
> >
> > No reason than simplicity and readability, I think. There's always a
> > tradeoff between optimization and readable code. Patches are welcome,
> > though. But please make sure that it works with all SQLAlchemy version
> >  >=0.3.
> >
>
> I'll read that one and test, I like the idea of sql optimizing the
> identity check sounds interesting for tg1 and tg2.... :)
> Could you provide a patch in our trac system so that I don't lose that
> nugget?
>
> Florent.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to