Example #1
0
 def make_value_from_datastore(self, value):
     logging.info("MAKE FROM DATASTORE")
     logging.info("Value: " + str(value))
     if value is not None:
         logging.info("Retrieving value (following this log)")
         logging.info(str(CacheController.from_protobuf(value)))
         return CacheController.from_protobuf(value)
Example #2
0
                        def txn(ticket):
                            
                            logging.info('Beginning transaction.')
                            
                            entity, natural = DataController.generateNaturalKind(ticket.subject)
                            
                            logging.info('Split natural kind. N: '+str(natural)+', E: '+str(entity))
                            
                            if ticket.queue_indexing:

                                logging.info('Indexing requested. Queueing request...')

                                index_queue, index_task = IndexController.queueNewEntity(entity, return_task=True)
                                index_task.add(index_queue.name, transactional=True)
                                
                            if ticket.queue_caching:

                                logging.info('Caching requested. Queueing request...')
                                
                                cache_queue, cache_task = CacheController.queueNewEntity(entity, return_task=True)
                                cache_task.add(cache_queue.name, transactional=True)


                            ## @TODO: figure out way to merge descriptors in and put them too
                            
                            #if ticket.attachments is not None:
                            #    for item in ticket.attachments:
                            #        pass
                                    
                            logging.info('Putting commit list...')

                            return True
Example #3
0
 def get_value_for_datastore(self, model_instance):
     logging.info("GET VALUE FOR DATASTORE.")
     value = self.__get__(model_instance, model_instance.__class__)
     if value is not None:
         pb_s = CacheController.to_protobuf(value)
         logging.info("Protobuf: " + str(pb_s))
         logging.info("Storing value (following this log)")
         # _pb = force_encode_utf8(pb_s)
         return db.Blob(pb_s)
Example #4
0
 def make_value_from_datastore(self, value):
     return [CacheController.from_protobuf(x) for x in value]
Example #5
0
 def validate_list_contents(self, value):
     return [db.Blob(CacheController.to_protobuf(x)) for x in value]