please email me the patch

On Dec 17, 12:37 pm, Thadeus Burgess <[email protected]> wrote:
> For helpful usages, when needing a query exported to a human readable
> formatted report, export_to_csv needs to allow to call the represent
> function.
>
> diff -r 3a3a4c079479 gluon/sql.py
> --- a/gluon/sql.py    Wed Dec 16 13:09:19 2009 -0600
> +++ b/gluon/sql.py    Thu Dec 17 12:21:00 2009 -0600
> @@ -3367,6 +3367,7 @@
>          delimiter = kwargs.get('delimiter', ',')
>          quotechar = kwargs.get('quotechar', '"')
>          quoting = kwargs.get('quoting', csv.QUOTE_MINIMAL)
> +        represent = kwargs.get('represent', False)
>          writer = csv.writer(ofile, delimiter=delimiter,
>                              quotechar=quotechar, quoting=quoting)
>          # a proper csv starting with the column names
> @@ -3395,10 +3396,17 @@
>                      row.append(record._extra[col])
>                  else:
>                      (t, f) = col.split('.')
> +                    if isinstance(record.get(t, None), (Row,dict)):
>
>                          row.append(none_exception(record[t][f]))
>                      else:
> +                        if represent:
> +                            if self.db[t][f].represent:
> +
> row.append(none_exception(self.db[t][f].represent(record[f])))
> +                            else:
> +                                row.append(none_exception(record[f]))
> +                        else:
> +                            row.append(none_exception(record[f]))
>              writer.writerow(row)
>
>      def __str__(self):
>
> -Thadeus

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" 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/web2py?hl=en.


Reply via email to