The unified diff between revisions [705545af..] and [eb1440d9..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'yowie.py'
#
#
# patch "yowie.py"
# from [8303d0a3d2730d9b7caf3d9dab5260c25705787d]
# to [7b6a0cb3235f0229a909686791a0fb28738e5685]
#
============================================================
--- yowie.py 8303d0a3d2730d9b7caf3d9dab5260c25705787d
+++ yowie.py 7b6a0cb3235f0229a909686791a0fb28738e5685
@@ -18,6 +18,8 @@ class DeviceProxy:
for required in ('driver', 'zone'):
if not self.config.has_key(required):
raise Exception('Cannot initialize device %s: required config item %s unspecified.' % (device_name, required))
+ def get_filename(self, table):
+ return os.path.join(config.data_path, self.device_name, table) + '.csv'
class Table:
def __init__(self, table_name, column_file):
@@ -36,7 +38,8 @@ class TableIO:
for row in csv.reader(open(self.filename)):
yield row
- def write(self, header, rows):
+ def write(self, rows):
+ header = self.implement.columns
# use a temporary file; this avoids annoying problems where an update fails half-way
# through and we potentially commit a half-complete version of the file.
tmp_fdno, tmp_filename = tempfile.mkstemp(suffix='.csv', prefix='yowie')
@@ -174,9 +177,6 @@ if __name__ == '__main__':
os.mkdir(datadir)
return datadir
- def get_filename(device, table):
- return os.path.join(config.data_path, device, table) + '.csv'
-
def update_device(device):
log("updating: " + device)
export = drivers[devices[device].config['driver']]
@@ -189,9 +189,8 @@ if __name__ == '__main__':
if not has_table(table):
continue
log("updating table %s on: %s" % (table, device))
- tio = TableIO(tables[table], get_filename(device, table))
- header = tables[table].columns
- tio.write(header, get_table(table, tio, devices[device]))
+ tio = TableIO(tables[table], devices[device].get_filename(table))
+ tio.write(get_table(table, tio, devices[device]))
monotone_setup()
drivers = init_drivers()