Exemple #1
0
 def gets(self):
     method_name = 'LanguageMapper.gets'
     log.info('{}: initialization.'.format(method_name))
     languages = []
     for db_language in Languages.select():
         languages.append(self.mapper(db_language))
     log.info('{}: end.'.format(method_name))
     return languages
Exemple #2
0
 def insert(self, language_object):
     method_name = 'LanguageMapper.insert'
     log.info('{}: initialization.'.format(method_name))
     query = Languages.insert(acronym=language_object.acronym,
                              title=language_object.title)
     language_object.id = query.execute()  # Return new id
     log.info('{}: end.'.format(method_name))
     return language_object
 def gets(self):
     method_name = 'LanguageMapper.gets'
     log.info('{}: initialization.'.format(method_name))
     languages = []
     for db_language in Languages.select():
         languages.append(self.mapper(db_language));
     log.info('{}: end.'.format(method_name))
     return languages
 def update(self, language_object):
     method_name = 'LanguageMapper.update'
     log.info('{}: initialization.'.format(method_name))
     query = Languages.update(acronym=language_object.acronym, 
                              title=language_object.title).where(Languages.id==language_object.id)
     log.info('{}: end.'.format(method_name))
     if query.execute() != 1: return True
     else: return False
 def insert(self, language_object):
     method_name = 'LanguageMapper.insert'
     log.info('{}: initialization.'.format(method_name))
     query = Languages.insert(acronym=language_object.acronym, 
                              title=language_object.title)
     language_object.id = query.execute() # Return new id
     log.info('{}: end.'.format(method_name))
     return language_object
Exemple #6
0
 def update(self, language_object):
     method_name = 'LanguageMapper.update'
     log.info('{}: initialization.'.format(method_name))
     query = Languages.update(acronym=language_object.acronym,
                              title=language_object.title).where(
                                  Languages.id == language_object.id)
     log.info('{}: end.'.format(method_name))
     if query.execute() != 1: return True
     else: return False
 def get(self, language_id):
     method_name = 'LanguageMapper.get'
     log.info('{}: initialization.'.format(method_name))
     
     try:
         language_object = Languages.get(Languages.id==language_id)
         log.info('{}: end.'.format(method_name))
         return self.mapper(language_object)
     except Exception as e:
         log.info('LanguagesDoesNotExist errno={}: strerror{}.'.format(e.errno, e.strerror))
         log.info('{}: end.'.format(method_name))
         raise Exception('LanguagesDoesNotExist errno={}: strerror{}.'.format(e.errno, e.strerror))
Exemple #8
0
    def get(self, language_id):
        method_name = 'LanguageMapper.get'
        log.info('{}: initialization.'.format(method_name))

        try:
            language_object = Languages.get(Languages.id == language_id)
            log.info('{}: end.'.format(method_name))
            return self.mapper(language_object)
        except Exception as e:
            log.info('LanguagesDoesNotExist errno={}: strerror{}.'.format(
                e.errno, e.strerror))
            log.info('{}: end.'.format(method_name))
            raise Exception(
                'LanguagesDoesNotExist errno={}: strerror{}.'.format(
                    e.errno, e.strerror))