diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-16 23:32:24 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-16 23:32:24 +0300 |
commit | eb930123454771b80465505579d723c92b3dd84c (patch) | |
tree | 9aeded9c85edc2ae9c00ae904d252558731d93f7 /vk/utils/tracking/db/writer/csv.py | |
parent | make "last seen" timestamps timezone-aware (diff) | |
download | vk-scripts-eb930123454771b80465505579d723c92b3dd84c.tar.gz vk-scripts-eb930123454771b80465505579d723c92b3dd84c.zip |
refactoring & support more user fields
And a bunch of other minor improvements.
Diffstat (limited to 'vk/utils/tracking/db/writer/csv.py')
-rw-r--r-- | vk/utils/tracking/db/writer/csv.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/vk/utils/tracking/db/writer/csv.py b/vk/utils/tracking/db/writer/csv.py index 8dc2299..8c635b4 100644 --- a/vk/utils/tracking/db/writer/csv.py +++ b/vk/utils/tracking/db/writer/csv.py @@ -36,8 +36,12 @@ class Writer: def write_record(self, user): if not self: return - self._write_row(Record.from_user(user).to_row()) + self._write_row(self._record_to_row(Record.from_user(user))) self.flush() def _write_row(self, row): self._writer.writerow(row) + + @staticmethod + def _record_to_row(record): + return [str(record.get_timestamp())] + [str(record[field]) for field in record] |