Exemple #1
0
 def get_entitylist(cls, text):
     l10nobject = cls.get_structure(text)
     entitylist = EntityList()
     for i in l10nobject:
         if isinstance(i, Entity):
             entitylist.add(i)
     return entitylist
Exemple #2
0
 def parse_to_entitylist(cls, text, code='default'):
     entityList = EntityList()
     text = cls.patterns['comment'].sub('', text)
     matchlist = cls.patterns['entity'].findall(text)
     for match in matchlist:
         if match[0]:
             entityList.add_entity(GettextEntity(match[0], match[1]))
     return entityList
Exemple #3
0
 def parse_to_entitylist(cls, text, code='default'):
     entityList = EntityList()
     text = cls.patterns['comment'].sub('', text)
     matchlist = cls.patterns['entity'].findall(text)
     for match in matchlist:
         if match[0]:
             entityList.add_entity(Entity(match[0], match[1], code))
     return entityList
Exemple #4
0
    def get_entitylist(cls, path, source=False, code='default', parser=None):

        entityList = EntityList()
        (path, table) = cls._explode_path(path)
        con = cls._connected()
        if not con:
            cls._connect(path)

        cursor = cls.connection.cursor()
        cursor.execute('SELECT * FROM ' + table)
        for row in cursor:
            entitylist.add_entity(Entity(row[0], row[1]))
        cursor.close()
        if not con:
            cls._close()
        return entitylist