Exemple #1
0
def override_command(command, func):
    global __COMMANDS_OVERRIDE
    local_dir = os.path.dirname(compat_inspect.stack()[2][1])

    if __COMMANDS_OVERRIDE.has_key(command):
        __COMMANDS_OVERRIDE[command].append((func, local_dir))
    else:
        __COMMANDS_OVERRIDE[command] = [(func, local_dir)]
 def decorator(f):
     local_dir = os.path.dirname(compat_inspect.stack()[1][1])
     if kind == "post":
         hook = PostHookWrapper(f, command_name, local_dir)
     elif kind == "pre":
         hook = PreHookWrapper(f, command_name, local_dir)
     else:
         raise ValueError("invalid hook kind %s" % kind)
     return hook
Exemple #3
0
 def decorator(f):
     local_dir = os.path.dirname(compat_inspect.stack()[1][1])
     if kind == "post":
         hook = PostHookWrapper(f, command_name, local_dir)
     elif kind == "pre":
         hook = PreHookWrapper(f, command_name, local_dir)
     else:
         raise ValueError("invalid hook kind %s" % kind)
     return hook
Exemple #4
0
 def decorator(f):
     local_dir = os.path.dirname(compat_inspect.stack()[1][1])
     add_to_registry((f, local_dir, help_bypass), name)
     if kind == "post":
         add_to_post_registry((f, local_dir, help_bypass), command_name)
     elif kind == "pre":
         add_to_pre_registry((f, local_dir, help_bypass), command_name)
     else:
         raise ValueError("invalid hook kind %s" % kind)