Пример #1
0
def UpdateAfterChecking(idurl, xml_src):
    """
    Need to call that method to update the cache when some identity sources is
    changed.
    """
    #out(12, 'identitycache.UpdateAfterChecking ' + url)
    return identitydb.update(idurl, xml_src)
Пример #2
0
def CacheCentralID(success_func=None, fail_func=None):
    """
    Check and request a Central server identity. 
    """
    dhnio.Dprint(6, 'identitycache.CacheCentralID')
    if HasKey(settings.CentralID()):
        if success_func:
            success_func('')
        return
    src = dhnio._read_data(os.path.join(dhnio.getExecutableDir(), 'dhncentral.xml'))
    if src:
        if identitydb.update(settings.CentralID(), src):
            if success_func:
                success_func('')
            return
    d = immediatelyCaching(settings.CentralID())
    if success_func is not None:
        d.addCallback(success_func)
    if fail_func is not None:
        d.addErrback(fail_func)
    else:
        d.addErrback(lambda x: dhnio.Dprint(6, 'identitycache.CacheCentralID NETERROR: '+x.getErrorMessage()))