Ejemplo n.º 1
0
def load_csv_table(path, table):
	try:
		f = os.path.join(path, '%s.csv'%(table,))
		#last_sync[f] = os.stat(f).st_mtime
		for p in csv.DictReader(open(f, 'rt')):
			store.add_data(table, {k:(v.decode('utf8') if (k in unicode_strings and v) else v) for k,v in p.items()})
	except OSError as e:
		pass
		#print 'Load csv table %s %s failed: %s'%(path, table, e)
	except IOError as e:
		pass
	except sqlite3.IntegrityError as e:
		print 'Load csv table %s failed: %s'%(table, e)
Ejemplo n.º 2
0
	def revert(self):
		store.add_data('unit', self.unit)
		store.add_data('garrison_unit', self.garrison_unit)
Ejemplo n.º 3
0
	def revert(self):
		store.add_data('garrison_queue_unit', self.queue_unit)
Ejemplo n.º 4
0
	def revert(self):
		store.add_data('action', self.action)
Ejemplo n.º 5
0
	def perform(self):
		store.add_data('action', {'action_type':self.action_type_id, 'x':self.coord[0], 'y':self.coord[1], 'fleet_id':self.fleet_id, 'unit_id':self.unit_id, 'user_id':self.user_id})