Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin.support.xappy.replaylog Namespace Reference

Classes

class  NotifyingDeleteObject
class  ReplayLog
class  LoggedProxy
class  LoggedProxyMethod

Functions

def set_replay_path
def _unproxy_call_and_args
def log

Variables

string __docformat__ = "restructuredtext en"
 _replay_log = None
 _had_replay_log = False

Function Documentation

def MoinMoin.support.xappy.replaylog._unproxy_call_and_args (   call,
  args 
) [private]
Convert a call and list of arguments to unproxied form.

Definition at line 389 of file replaylog.py.

00389 
00390 def _unproxy_call_and_args(call, args):
00391     """Convert a call and list of arguments to unproxied form.
00392 
00393     """
00394     if isinstance(call, LoggedProxyMethod):
00395         realcall = call.real
00396     else:
00397         realcall = call
00398 
00399     realargs = []
00400     for arg in args:
00401         if isinstance(arg, LoggedProxy):
00402             arg = arg.__obj
00403         realargs.append(arg)
00404 
00405     return realcall, realargs

Here is the caller graph for this function:

def MoinMoin.support.xappy.replaylog.log (   call,
  args 
)
Make a call to xapian, and log it.

Definition at line 406 of file replaylog.py.

00406 
00407 def log(call, *args):
00408     """Make a call to xapian, and log it.
00409 
00410     """
00411     # If we've never had a replay log in force, no need to unproxy objects.
00412     global _had_replay_log
00413     if not _had_replay_log:
00414         return call(*args)
00415 
00416     # Get unproxied versions of the call and arguments.
00417     realcall, realargs = _unproxy_call_and_args(call, args)
00418 
00419     # If we have no replay log currently, just do the call.
00420     global _replay_log
00421     replay_log = _replay_log
00422     if replay_log is None:
00423         return realcall(*realargs)
00424 
00425     # We have a replay log: do a logged version of the call.
00426     call_id = replay_log.log_call(call, *args)
00427     try:
00428         ret = realcall(*realargs)
00429     except:
00430         replay_log.log_except(sys.exc_info(), call_id)
00431         raise
00432     return replay_log.log_retval(ret, call_id)
00433 
00434 #set_replay_path('replay.log')

Here is the call graph for this function:

Here is the caller graph for this function:

Set the path for the replay log.

Definition at line 377 of file replaylog.py.

00377 
00378 def set_replay_path(logpath):
00379     """Set the path for the replay log.
00380 
00381     """
00382     global _replay_log
00383     global _had_replay_log
00384     if logpath is None:
00385         _replay_log = None
00386     else:
00387         _had_replay_log = True
00388         _replay_log = ReplayLog(logpath)


Variable Documentation

string MoinMoin.support.xappy.replaylog.__docformat__ = "restructuredtext en"

Definition at line 21 of file replaylog.py.

Definition at line 39 of file replaylog.py.

Definition at line 36 of file replaylog.py.