Пример #1
0
 def gets(self):
     method_name = 'LemmaMapper.gets'
     log.info('{}: initialization.'.format(method_name))
     lemmas = []
     for db_lemma in Lemmas.select():
         lemmas.append(self.mapper(db_lemma))
     log.info('{}: end.'.format(method_name))
     return lemmas
Пример #2
0
 def gets(self):
     method_name = 'LemmaMapper.gets'
     log.info('{}: initialization.'.format(method_name))
     lemmas = []
     for db_lemma in Lemmas.select():
         lemmas.append(self.mapper(db_lemma));
     log.info('{}: end.'.format(method_name))
     return lemmas
Пример #3
0
 def update(self, lemma_object):
     method_name = 'LemmaMapper.update'
     log.info('{}: initialization.'.format(method_name))
     query = Lemmas.update(lemma=lemma_object.lemma, 
                          pos_id=lemma_object.pos_id, syllables=lemma_object.syllables, 
                          length=lemma_object.length).where(Lemmas.id==lemma_object.id)
     log.info('{}: end.'.format(method_name))
     if query.execute() != 1: return True
     else: return False
Пример #4
0
 def insert(self, lemma_object):
     method_name = 'LemmaMapper.insert'
     log.info('{}: initialization.'.format(method_name))
     query = Lemmas.insert(lemma=lemma_object.lemma, 
                          pos_id=lemma_object.pos_id, syllables=lemma_object.syllables, 
                          length=lemma_object.length)
     lemma_object.id = query.execute() # Return new id
     log.info('{}: end.'.format(method_name))
     return lemma_object
Пример #5
0
 def insert(self, lemma_object):
     method_name = 'LemmaMapper.insert'
     log.info('{}: initialization.'.format(method_name))
     query = Lemmas.insert(lemma=lemma_object.lemma,
                           pos_id=lemma_object.pos_id,
                           syllables=lemma_object.syllables,
                           length=lemma_object.length)
     lemma_object.id = query.execute()  # Return new id
     log.info('{}: end.'.format(method_name))
     return lemma_object
Пример #6
0
 def update(self, lemma_object):
     method_name = 'LemmaMapper.update'
     log.info('{}: initialization.'.format(method_name))
     query = Lemmas.update(
         lemma=lemma_object.lemma,
         pos_id=lemma_object.pos_id,
         syllables=lemma_object.syllables,
         length=lemma_object.length).where(Lemmas.id == lemma_object.id)
     log.info('{}: end.'.format(method_name))
     if query.execute() != 1: return True
     else: return False
Пример #7
0
 def get(self, lemma_id):
     method_name = 'LemmaMapper.get'
     log.info('{}: initialization.'.format(method_name))
     
     try:
         lemma_object = Lemmas.get(Lemmas.id==lemma_id)
         log.info('{}: end.'.format(method_name))
         return self.mapper(lemma_object)
     except Exception as e:
         log.info('LemmaDoesNotExist errno={}: strerror{}.'.format(e.errno, e.strerror))
         log.info('{}: end.'.format(method_name))
         raise Exception('FilesDoesNotExist errno={}: strerror{}.'.format(e.errno, e.strerror))
Пример #8
0
    def get(self, lemma_id):
        method_name = 'LemmaMapper.get'
        log.info('{}: initialization.'.format(method_name))

        try:
            lemma_object = Lemmas.get(Lemmas.id == lemma_id)
            log.info('{}: end.'.format(method_name))
            return self.mapper(lemma_object)
        except Exception as e:
            log.info('LemmaDoesNotExist errno={}: strerror{}.'.format(
                e.errno, e.strerror))
            log.info('{}: end.'.format(method_name))
            raise Exception('FilesDoesNotExist errno={}: strerror{}.'.format(
                e.errno, e.strerror))