Пример #1
0
def test_use_master():
    local = context.multidb.pinning._locals
    eq_(getattr(local, 'pinned', False), False)
    with context.use_master():
        eq_(local.pinned, True)
        with context.use_master():
            eq_(local.pinned, True)
        eq_(local.pinned, True)
    eq_(local.pinned, False)
Пример #2
0
def test_use_master():
    local = context.multidb.pinning._locals
    eq_(getattr(local, 'pinned', False), False)
    with context.use_master():
        eq_(local.pinned, True)
        with context.use_master():
            eq_(local.pinned, True)
        eq_(local.pinned, True)
    eq_(local.pinned, False)
Пример #3
0
def test_use_master():
    multidb.pinning.unpin_this_thread()
    local = models.multidb.pinning._locals
    eq_(getattr(local, 'pinned', False), False)
    with models.use_master():
        eq_(local.pinned, True)
        with models.use_master():
            eq_(local.pinned, True)
        eq_(local.pinned, True)
    eq_(local.pinned, False)
Пример #4
0
 def wrapper(*args, **kw):
     with models.use_master():
         return f(*args, **kw)
Пример #5
0
 def wrapper(*args, **kw):
     with models.use_master():
         return f(*args, **kw)