Doh, Sean got there before me, __radd__ (and the other operations)
handle the reverse situation: http://dpaste.com/49224/ - example.
Looks like very cool stuff.  I would recommend writing tests first,
based on what should happen(not necessarily what does), and then
continue with the code however.

On May 10, 9:50 am, Sean Legassick <[EMAIL PROTECTED]> wrote:
> On 10 May 2008, at 14:47, Sebastian Noack wrote:
>
> > You can still do model.objects.update(foo=42) with my patch, because
> > of 42 is casted to a LiteralExpr under the hood. I could even make it
> > possible to do model.objects.update(foo=CurrentExpr() + 42). But there
> > is no way to enable model.objects.update(foo=42 + CurrentExpr()),
> > because of in this case int.__add__ instead of Expression.__add__ is
> > called, so I decided to introduce LiteralExpr. But I agree that it
> > would be cool, if you could use a literal as it is.
>
> You can handle this case by defining Expression.__radd__ 
> (seehttp://docs.python.org/ref/numeric-types.html)
>
> --
> Sean
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to