Ejemplo n.º 1
0
def main():
    try:
        test_open()
        test_query()
        test_insert("joseph")
        test_insert("lisa")
        
        test_getAll()
        test_getOne(2)
        test_update(2)
        test_getOne(2)
        
        test_deleteDB() 
               
    except:
        print trace_back()    
Ejemplo n.º 2
0
 def call(self,data):
     _data = json.loads(data)
     #print _data        
     if _data['_package'] == "app.mainwindow":   
         self.callbackMainWindow(_data)            
     else:            
         result = {}         
         try:  
             status = 0                        
             packageName = _data['_package']
             className = _data['_class']
             methodName = _data['_function']
             
             #dyn=Dynload(packageName,['*'])
             
             #ins=dyn.getClassInstance(className)
             #res = dyn.execMethod(ins, methodName)
             #dyn.execfunc('test','Hello','function!')
             
             #print packageName,className,methodName
             the_class = getattr(__import__(packageName, globals(), locals(),['*'], -1),className)
             instance = the_class()
             method = getattr(instance, methodName)
             #print method
             res = method(_data['_args'])        
             result['data'] = res                      
         except:
             status = 1
             res = trace_back()
             #print res         
             res = res.replace("\"","'")
             res = res.replace("\n","<br>")
             result['message'] = res
         
         result['error'] = status
         #print result
         self.callback(result)