Exemple #1
0
def find_tables_by_statistic(stat_id):
    tables = load_cached(stat_id=stat_id, _type='table_list')
    if not tables:
        service = get_recherche_service().service
        data = service.TabellenKatalog(config.get('user'), config.get('password'), "%s-*" % stat_id, 
                                       "code", "100", config.get('lang'))
        tables = []
        #print data
        if hasattr(data.objektKatalogEintraege, 'abrufbar'):
            tables.append(serialize_soap(data.objektKatalogEintraege))
        else:
            for t in data.objektKatalogEintraege:
                tables.append(serialize_soap(t)) 
        cache_result(tables, stat_id=stat_id, _type='table_list')
    elif tables == EMPTY:
        return []
    return tables
Exemple #2
0
def find_tables_by_statistic(stat_id):
    tables = load_cached(stat_id=stat_id, _type='table_list')
    if not tables:
        service = get_recherche_service().service
        data = service.TabellenKatalog(config.get('user'),
                                       config.get('password'),
                                       "%s-*" % stat_id, "code", "100",
                                       config.get('lang'))
        tables = []
        #print data
        if hasattr(data.objektKatalogEintraege, 'abrufbar'):
            tables.append(serialize_soap(data.objektKatalogEintraege))
        else:
            for t in data.objektKatalogEintraege:
                tables.append(serialize_soap(t))
        cache_result(tables, stat_id=stat_id, _type='table_list')
    elif tables == EMPTY:
        return []
    return tables
Exemple #3
0
def get_variable(var_value, var_name='code'):
    variable = load_cached(var_value=var_value,
                           var_name=var_name,
                           _type='feature')
    if not variable:
        service = get_recherche_service().service
        variable = service.MerkmalsKatalog(
            config.get('user'),
            config.get('password'),
            var_value,
            var_name,
            "*",
            "Alle",
            "100",
            config.get('lang'),
        )
        if variable.objektKatalogEintraege:
            variable = serialize_soap(variable.objektKatalogEintraege[0])
            data = service.MerkmalAuspraegungenKatalog(
                config.get('user'),
                config.get('password'),
                variable.get('code'),
                "*",
                "",
                "100",
                config.get('lang'),
            )
            if data.merkmalAuspraegungenKatalogEintraege:
                attributes = []
                for e in data.merkmalAuspraegungenKatalogEintraege:
                    attributes.append(serialize_soap(e))
                variable['attributes'] = attributes
        else:
            variable = None
        cache_result(variable,
                     var_value=var_value,
                     var_name=var_name,
                     _type='feature')
    elif variable == EMPTY:
        return None
    return variable
Exemple #4
0
def get_variable(var_value, var_name='code'):
    variable = load_cached(var_value=var_value, var_name=var_name, _type='feature')
    if not variable:
        service = get_recherche_service().service
        variable = service.MerkmalsKatalog(config.get('user'), config.get('password'), var_value, 
                                           var_name, "*", "Alle", "100", config.get('lang'), )
        if variable.objektKatalogEintraege:
            variable = serialize_soap(variable.objektKatalogEintraege[0])
            data = service.MerkmalAuspraegungenKatalog(config.get('user'), config.get('password'), 
                                                             variable.get('code'), "*", "", "100", config.get('lang'), )
            if data.merkmalAuspraegungenKatalogEintraege:
                attributes = []
                for e in data.merkmalAuspraegungenKatalogEintraege:
                    attributes.append(serialize_soap(e))
                variable['attributes'] = attributes
        else:
            variable = None
        cache_result(variable, var_value=var_value, var_name=var_name, _type='feature')
    elif variable == EMPTY:
        return None
    return variable
Exemple #5
0
def get_table_meta(table_id):
    table = load_cached(table_id=table_id, _type='table_meta')
    if not table:
        service = get_recherche_service().service
        data = service.TabellenKatalog(config.get('user'), config.get('password'), 
                                        table_id, "", "100", config.get('lang'))
        #print data
        if data.objektKatalogEintraege:
            table = serialize_soap(data.objektKatalogEintraege[0])
        cache_result(table, table_id=table_id, _type='table_meta')
    elif table == EMPTY:
        return None
    return table
Exemple #6
0
def get_statistic(stat_id):
    statistic = load_cached(stat_id=stat_id, _type='statistic')
    if not statistic:
        service = get_recherche_service().service
        data = service.StatistikKatalog(config.get('user'), config.get('password'), 
                                        stat_id, "", "100", config.get('lang'))
        #print data
        if data.objektKatalogEintraege:
            statistic = serialize_soap(data.objektKatalogEintraege[0])
        cache_result(statistic, stat_id=stat_id, _type='statistic')
    elif statistic == EMPTY:
        return None
    return statistic
Exemple #7
0
def get_table_meta(table_id):
    table = load_cached(table_id=table_id, _type='table_meta')
    if not table:
        service = get_recherche_service().service
        data = service.TabellenKatalog(config.get('user'),
                                       config.get('password'), table_id, "",
                                       "100", config.get('lang'))
        #print data
        if data.objektKatalogEintraege:
            table = serialize_soap(data.objektKatalogEintraege[0])
        cache_result(table, table_id=table_id, _type='table_meta')
    elif table == EMPTY:
        return None
    return table
Exemple #8
0
def get_statistic(stat_id):
    statistic = load_cached(stat_id=stat_id, _type='statistic')
    if not statistic:
        service = get_recherche_service().service
        data = service.StatistikKatalog(config.get('user'),
                                        config.get('password'), stat_id, "",
                                        "100", config.get('lang'))
        #print data
        if data.objektKatalogEintraege:
            statistic = serialize_soap(data.objektKatalogEintraege[0])
        cache_result(statistic, stat_id=stat_id, _type='statistic')
    elif statistic == EMPTY:
        return None
    return statistic