class MySQLStorageTest(MockStorageTest): def setUp(self): try: import sqlTest except ImportError: raise "skip" self.s = MySQLStorage(sqlTest.dbc) cur = sqlTest.dbc.cursor() try: cur.execute("DELETE FROM test_person") except: cur.execute( """ CREATE TABLE test_person ( ID int not null auto_increment primary key, name varchar(32) ) """) def check_store_quotes(self): self.populate() row = self.s.fetch("test_person", 1) row["name"] = "j'mo\"cha's'ha''ha" self.s.store("test_person", **row) assert self.wholedb() == [{"ID":1, "name":"j'mo\"cha's'ha''ha"}, {"ID":2, "name":"wanda"}]
class MySQLStorageTest(MockStorageTest): def setUp(self): try: import sqlTest except ImportError: raise "skip" self.s = MySQLStorage(sqlTest.dbc) cur = sqlTest.dbc.cursor() try: cur.execute("DELETE FROM test_person") except: cur.execute(""" CREATE TABLE test_person ( ID int not null auto_increment primary key, name varchar(32) ) """) def check_store_quotes(self): self.populate() row = self.s.fetch("test_person", 1) row["name"] = "j'mo\"cha's'ha''ha" self.s.store("test_person", **row) assert self.wholedb() == [{ "ID": 1, "name": "j'mo\"cha's'ha''ha" }, { "ID": 2, "name": "wanda" }]
def setUp(self): try: import sqlTest except ImportError: raise "skip" self.s = MySQLStorage(sqlTest.dbc) cur = sqlTest.dbc.cursor() try: cur.execute("DELETE FROM test_person") except: cur.execute(""" CREATE TABLE test_person ( ID int not null auto_increment primary key, name varchar(32) ) """)
def setUp(self): try: import sqlTest except ImportError: raise "skip" self.s = MySQLStorage(sqlTest.dbc) cur = sqlTest.dbc.cursor() try: cur.execute("DELETE FROM test_person") except: cur.execute( """ CREATE TABLE test_person ( ID int not null auto_increment primary key, name varchar(32) ) """)
def makeClerk(): import sqlCornerhost return Clerk(MySQLStorage(sqlCornerhost.connect()), schema)
def save_task(self): # populate with data from form: goal = self.input.get("goal") if goal: del self.input["goal"] obj = self._getInstance(Task) if goal: obj.goal = self.clerk.fetch(Goal, ID=goal) self.clerk.store(obj) self.redirect("?action=list&what=task") def act_(self): self.write(""" <ul> <li><a href="ws_generated.py?action=list&what=project">Project</a></li> <li><a href="ws_generated.py?action=list&what=goal">Goal</a></li> <li><a href="ws_generated.py?action=list&what=task">Task</a></li> <li><a href="ws_generated.py?action=list&what=class">Class</a></li> <li><a href="ws_generated.py?action=list&what=attr">Attr</a></li> <li><a href="ws_generated.py?action=list&what=link">Link</a></li> <li><a href="ws_generated.py?action=list&what=join">Join</a></li> </ul> """) if __name__ == "__main__": from arlo import Clerk from sqlPair import dbc from storage import MySQLStorage CLERK = Clerk(MySQLStorage(dbc), dbmap) print >> RES, MyAdminApp(CLERK, REQ).act()