comparison rhodecode/lib/utils.py @ 1528:1d7a621d396f beta

fixed action logger
author Marcin Kuzminski <marcin@python-works.com>
date Fri, 07 Oct 2011 22:50:20 +0200
parents 7d687ed11929
children 04027bdb876c
comparison
equal deleted inserted replaced
1525:4cd5ea766480 1528:1d7a621d396f
110 110
111 try: 111 try:
112 if hasattr(user, 'user_id'): 112 if hasattr(user, 'user_id'):
113 user_obj = user 113 user_obj = user
114 elif isinstance(user, basestring): 114 elif isinstance(user, basestring):
115 user_obj = User.by_username(user, cache=False) 115 user_obj = User.by_username(user)
116 else: 116 else:
117 raise Exception('You have to provide user object or username') 117 raise Exception('You have to provide user object or username')
118 118
119 rm = RepoModel() 119 rm = RepoModel()
120 if hasattr(repo, 'repo_id'): 120 if hasattr(repo, 'repo_id'):
187 :param base_path: 187 :param base_path:
188 188
189 :return True: if given path is a valid repository 189 :return True: if given path is a valid repository
190 """ 190 """
191 full_path = os.path.join(base_path, repo_name) 191 full_path = os.path.join(base_path, repo_name)
192 192
193 try: 193 try:
194 get_scm(full_path) 194 get_scm(full_path)
195 return True 195 return True
196 except VCSError: 196 except VCSError:
197 return False 197 return False
202 202
203 :param repo_name: 203 :param repo_name:
204 :param base_path: 204 :param base_path:
205 """ 205 """
206 full_path = os.path.join(base_path, repos_group_name) 206 full_path = os.path.join(base_path, repos_group_name)
207 207
208 # check if it's not a repo 208 # check if it's not a repo
209 if is_valid_repo(repos_group_name, base_path): 209 if is_valid_repo(repos_group_name, base_path):
210 return False 210 return False
211 211
212 # check if it's a valid path 212 # check if it's a valid path
213 if os.path.isdir(full_path): 213 if os.path.isdir(full_path):
214 return True 214 return True
215 215
216 return False 216 return False
217 217
218 def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): 218 def ask_ok(prompt, retries=4, complaint='Yes or no, please!'):
219 while True: 219 while True:
220 ok = raw_input(prompt) 220 ok = raw_input(prompt)
221 if ok in ('y', 'ye', 'yes'): 221 if ok in ('y', 'ye', 'yes'):
222 return True 222 return True