Changeset - 1d7a621d396f
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 14 years ago 2011-10-07 22:50:20
marcin@python-works.com
fixed action logger
1 file changed with 6 insertions and 6 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/utils.py
Show inline comments
 
@@ -109,13 +109,13 @@ def action_logger(user, action, repo, ip
 
        sa = meta.Session()
 

	
 
    try:
 
        if hasattr(user, 'user_id'):
 
            user_obj = user
 
        elif isinstance(user, basestring):
 
            user_obj = User.by_username(user, cache=False)
 
            user_obj = User.by_username(user)
 
        else:
 
            raise Exception('You have to provide user object or username')
 

	
 
        rm = RepoModel()
 
        if hasattr(repo, 'repo_id'):
 
            repo_obj = rm.get(repo.repo_id, cache=False)
 
@@ -186,13 +186,13 @@ def is_valid_repo(repo_name, base_path):
 
    :param repo_name:
 
    :param base_path:
 

	
 
    :return True: if given path is a valid repository
 
    """
 
    full_path = os.path.join(base_path, repo_name)
 
    
 

	
 
    try:
 
        get_scm(full_path)
 
        return True
 
    except VCSError:
 
        return False
 

	
 
@@ -201,23 +201,23 @@ def is_valid_repos_group(repos_group_nam
 
    Returns True if given path is a repos group False otherwise
 
    
 
    :param repo_name:
 
    :param base_path:
 
    """
 
    full_path = os.path.join(base_path, repos_group_name)
 
    
 

	
 
    # check if it's not a repo
 
    if is_valid_repo(repos_group_name, base_path):
 
        return False
 
    
 

	
 
    # check if it's a valid path
 
    if os.path.isdir(full_path):
 
        return True
 
    
 

	
 
    return False
 
    
 

	
 
def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
 
    while True:
 
        ok = raw_input(prompt)
 
        if ok in ('y', 'ye', 'yes'):
 
            return True
 
        if ok in ('n', 'no', 'nop', 'nope'):
0 comments (0 inline, 0 general)