def mkusr(): u = User() u.id = 1 u.email = '*****@*****.**' u.username = '******' u.name = 'Kurohai' u.password = '******' u.admin = True session.add(u) session.commit()
def emit(self, record): trace = None exc = record.__dict__['exc_info'] if exc: trace = traceback.format_exc(exc) log = Log( logger=record.__dict__['name'], level=record.__dict__['levelname'], trace=trace, msg=record.__dict__['msg'],) session.add(log) session.commit()
def mkusr(): print 'adding user' u = User() a = Admin() u.username = a.username u.id = a.id u.email = a.email u.password = a.password u.admin = a.admin session.add(u) session.commit()
def mkdir(): d = Directory() d.name = 'test' d.path = 'd:/dropbox/' session.add(d) session.commit()
def data(): day = ColorSet() yellow = Color() yellow.name = 'yellow' yellow.colorset = day white = Color() white.name = 'white' white.colorset = day pink = Color() pink.name = 'pink' pink.colorset = day purple = Color() purple.name = 'purple' purple.colorset = day olive = Color() olive.name = 'olive' olive.colorset = day azure = Color() azure.name = 'azure' azure.colorset = day camo = Color() camo.name = 'camo' camo.colorset = day session.add(day) session.add(yellow) session.add(white) session.add(pink) session.add(purple) session.add(olive) session.add(azure) session.add(camo) session.commit() d = session.query(ColorSet).all() for i in d: print i.date print i.id for c in i.colors: print c.name