コード例 #1
0
 def base_create_dep_objs(cls):
     """
     Create all objects that TransactionKeyValue need.
     """
     trans = Transactions()
     keys = Keys()
     values = Values()
     TestTransactions.base_create_dep_objs()
     trans.from_hash(SAMPLE_TRANSACTION_HASH)
     trans.save(force_insert=True)
     TestKeys.base_create_dep_objs()
     keys.from_hash(SAMPLE_KEY_HASH)
     keys.save(force_insert=True)
     TestValues.base_create_dep_objs()
     values.from_hash(SAMPLE_VALUE_HASH)
     values.save(force_insert=True)
コード例 #2
0
 def base_create_dep_objs(cls):
     """
     Create all objects that FileKeyValue need.
     """
     keys = Keys()
     TestKeys.base_create_dep_objs()
     keys.from_hash(SAMPLE_KEY_HASH)
     keys.save(force_insert=True)
     values = Values()
     TestValues.base_create_dep_objs()
     values.from_hash(SAMPLE_VALUE_HASH)
     values.save(force_insert=True)
     files = Files()
     TestFiles.base_create_dep_objs()
     files.from_hash(SAMPLE_FILE_HASH)
     files.save(force_insert=True)
コード例 #3
0
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(TransactionKeyValue, self).from_hash(obj)
     if 'transaction_id' in obj:
         self.transaction = Transactions.get(Transactions.id == obj['transaction_id'])
     if 'value_id' in obj:
         self.value = Values.get(Values.id == obj['value_id'])
     if 'key_id' in obj:
         self.key = Keys.get(Keys.id == obj['key_id'])
コード例 #4
0
 def from_hash(self, obj):
     """Convert the hash into the object."""
     super(FileKeyValue, self).from_hash(obj)
     if 'file_id' in obj:
         self.file = Files.get(Files.id == obj['file_id'])
     if 'key_id' in obj:
         self.key = Keys.get(Keys.id == obj['key_id'])
     if 'value_id' in obj:
         self.value = Values.get(Values.id == obj['value_id'])
コード例 #5
0
 def from_hash(self, obj):
     """
     Converts the hash into the object
     """
     super(TransactionKeyValue, self).from_hash(obj)
     if 'transaction_id' in obj:
         self.transaction = Transactions.get(Transactions.id == obj['transaction_id'])
     if 'value_id' in obj:
         self.value = Values.get(Values.id == obj['value_id'])
     if 'key_id' in obj:
         self.key = Keys.get(Keys.id == obj['key_id'])
コード例 #6
0
 def from_hash(self, obj):
     """
     Converts the hash into the object
     """
     super(FileKeyValue, self).from_hash(obj)
     if 'file_id' in obj:
         self.file = Files.get(Files.id == obj['file_id'])
     if 'key_id' in obj:
         self.key = Keys.get(Keys.id == obj['key_id'])
     if 'value_id' in obj:
         self.value = Values.get(Values.id == obj['value_id'])
コード例 #7
0
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(TransactionKeyValue, self).where_clause(kwargs)
     if 'transaction_id' in kwargs:
         trans = Transactions.get(Transactions.id == kwargs['transaction_id'])
         where_clause &= Expression(TransactionKeyValue.transaction, OP.EQ, trans)
     if 'key_id' in kwargs:
         key = Keys.get(Keys.id == kwargs['key_id'])
         where_clause &= Expression(TransactionKeyValue.key, OP.EQ, key)
     if 'value_id' in kwargs:
         value = Values.get(Values.id == kwargs['value_id'])
         where_clause &= Expression(TransactionKeyValue.value, OP.EQ, value)
     return where_clause
コード例 #8
0
 def where_clause(self, kwargs):
     """Where clause for the various elements."""
     where_clause = super(FileKeyValue, self).where_clause(kwargs)
     if 'file_id' in kwargs:
         file_ = Files.get(Files.id == kwargs['file_id'])
         where_clause &= Expression(FileKeyValue.file, OP.EQ, file_)
     if 'key_id' in kwargs:
         key = Keys.get(Keys.id == kwargs['key_id'])
         where_clause &= Expression(FileKeyValue.key, OP.EQ, key)
     if 'value_id' in kwargs:
         value = Values.get(Values.id == kwargs['value_id'])
         where_clause &= Expression(FileKeyValue.value, OP.EQ, value)
     return where_clause
コード例 #9
0
 def where_clause(self, kwargs):
     """
     Where clause for the various elements.
     """
     where_clause = super(TransactionKeyValue, self).where_clause(kwargs)
     if 'transaction_id' in kwargs:
         trans = Transactions.get(Transactions.id == kwargs['transaction_id'])
         where_clause &= Expression(TransactionKeyValue.transaction, OP.EQ, trans)
     if 'key_id' in kwargs:
         key = Keys.get(Keys.id == kwargs['key_id'])
         where_clause &= Expression(TransactionKeyValue.key, OP.EQ, key)
     if 'value_id' in kwargs:
         value = Values.get(Values.id == kwargs['value_id'])
         where_clause &= Expression(TransactionKeyValue.value, OP.EQ, value)
     return where_clause
コード例 #10
0
 def where_clause(self, kwargs):
     """
     Where clause for the various elements.
     """
     where_clause = super(FileKeyValue, self).where_clause(kwargs)
     if 'file_id' in kwargs:
         file_ = Files.get(Files.id == kwargs['file_id'])
         where_clause &= Expression(FileKeyValue.file, OP.EQ, file_)
     if 'key_id' in kwargs:
         key = Keys.get(Keys.id == kwargs['key_id'])
         where_clause &= Expression(FileKeyValue.key, OP.EQ, key)
     if 'value_id' in kwargs:
         value = Values.get(Values.id == kwargs['value_id'])
         where_clause &= Expression(FileKeyValue.value, OP.EQ, value)
     return where_clause
コード例 #11
0
 def base_create_dep_objs(cls):
     """Create all objects that FileKeyValue need."""
     keys = Keys()
     TestKeys.base_create_dep_objs()
     keys.from_hash(SAMPLE_KEY_HASH)
     keys.save(force_insert=True)
     values = Values()
     TestValues.base_create_dep_objs()
     values.from_hash(SAMPLE_VALUE_HASH)
     values.save(force_insert=True)
     files = Files()
     TestFiles.base_create_dep_objs()
     files.from_hash(SAMPLE_FILE_HASH)
     files.save(force_insert=True)
コード例 #12
0
 def base_create_dep_objs(cls):
     """Create all objects that TransactionKeyValue need."""
     trans = Transactions()
     keys = Keys()
     values = Values()
     TestTransactions.base_create_dep_objs()
     trans.from_hash(SAMPLE_TRANSACTION_HASH)
     trans.save(force_insert=True)
     TestKeys.base_create_dep_objs()
     keys.from_hash(SAMPLE_KEY_HASH)
     keys.save(force_insert=True)
     TestValues.base_create_dep_objs()
     values.from_hash(SAMPLE_VALUE_HASH)
     values.save(force_insert=True)