예제 #1
0
def file_is_locale(filename):
    pat = re.compile("^/usr/share/locale/.*/(.*)\.mo")
    match = pat.search(filename)
    if match:
        l = match.group(1)
        lang.add_lang(l)
        return True
    else:
        return False
예제 #2
0
def write_edition(loc, edition):
    add_lang(edition)
    q = build_query(loc, edition)

    for a in (i for i in q.get('authors', []) if 'key' not in i):
        a['key'] = infogami.new_key('/type/author')

    key = infogami.new_key('/type/edition')
    last_key = key
    q['key'] = key
    ret = infogami.write(q, comment='initial import', machine_comment=loc)
    assert ret['status'] == 'ok'
    print(ret)
    pool.update(key, q)
예제 #3
0
def write_edition(loc, edition):
    add_lang(edition)
    q = build_query(loc, edition)

    for a in (i for i in q.get('authors', []) if 'key' not in i):
        a['key'] = infogami.new_key('/type/author')

    key = infogami.new_key('/type/edition')
    last_key = key
    q['key'] = key
    ret = infogami.write(q, comment='initial import', machine_comment=loc)
    assert ret['status'] == 'ok'
    print(ret)
    pool.update(key, q)