コード例 #1
0
ファイル: data.py プロジェクト: sgammon/ProvidenceClarity
 def _select_op(*args):
     
     global _mode
     
 
     worker = TransactionController.getTxnForDecorator(_mode)
     return worker
コード例 #2
0
ファイル: __init__.py プロジェクト: sgammon/ProvidenceClarity
    def do_base(self):
        
        from ProvidenceClarity.data.entity import E
        from ProvidenceClarity.api.data.transaction import TransactionController
        
        self.models = []
        self.entities = []
        
        if hasattr(self, 'base'):
            
            logging.info('Has base.')
            
            self.base()
            
            if isinstance(self.models, list):
                
                models_list = []
                entities_list = self.entities[:]
                
                for item in range(0, len(self.models)):
                    
                    if hasattr(self.models[item], '_PC_MODEL_BRANCH') and getattr(self.models[item], '_PC_MODEL_BRANCH') == _PC_MODEL_BRANCH_POLY:
                        entities_list.append(self.models[item])
                    else:
                        models_list.append(self.models[item])
                        
            else:
                return None
                
            if models_list is not None and isinstance(models_list, list) and len(models_list) > 0:

                mod = db.put(models_list)
            else:
                mod = None
                
            if entities_list is not None and isinstance(entities_list, list) and len(entities_list) > 0:
                ent = TransactionController.batchQueuedTransaction('entityCreate', entities_list)
        else:
            return True