def get_changed_entities(self): changed_entities = super(Budget, self).get_changed_entities() if 'be_transactions' in changed_entities: changed_entities['be_transaction_groups'] = ListofEntities(TransactionGroup) for tr in changed_entities.pop('be_transactions'): subtransactions = ListofEntities(Subtransaction) if 'be_subtransactions' in changed_entities: for subtr in [subtransaction for subtransaction in changed_entities.get('be_subtransactions') if subtransaction.entities_transaction_id == tr.id]: changed_entities['be_subtransactions'].remove(subtr) subtransactions.append(subtr) changed_entities['be_transaction_groups'].append(TransactionGroup( id=tr.id, be_transaction=tr, be_subtransactions=subtransactions )) if changed_entities.get('be_subtransactions') is not None: del changed_entities['be_subtransactions'] return changed_entities
def testentityIn2(self): tr1 = Transaction() tr2 = Transaction() transactions = ListofEntities(Transaction) transactions.append(tr1) self.assertNotIn(tr2, transactions)
def __call__(self, *args, **kwargs): from pynYNAB.Entity import ListofEntities return ListofEntities(self.type)