Is the goal to append fake (virtual) rows to the result of a
select(...)

Massimo

On Aug 20, 11:33 am, Carlos <carlosgali...@gmail.com> wrote:
> Hi Massimo,
>
> So far this is great !
>
> But, while we're on the lazy fields topic, can you implement the following
> specialized VirtualCommand (maybe named Virtual*Row*Command)?:
>
>     class VirtualRowCommand(object):
>         def __init__(self, method, row):
>             self.method = method
>             if len(row) != 1:
>                 a + b # raise an error.
>             self.row = *row.values()[0]*
>         def __call__(self, *args, **kwargs):
>             return self.method(self.row, *args, **kwargs)
>
> In my case, all my rows are a single item (whith is the table name), so it
> would be much better and simpler to use 'self' for the direct row (see
> "row.values()[0]" above).
>
> This way I can use virtual fields as follow:
>
>     class VirtualTest(object):
>         def x_id(vv, self):
>             return *self*.id
>
> Note that 'vv' (or any other name) is the VirtualTest instance (which I
> don't really care about), and 'self' is the actual specific row.
>
> Can you please consider this approach or something similar that accomplishes
> the same thing?.
>
> Thanks!,
>
>    Carlos

Reply via email to