Fix safe_father_of_first
This commit is contained in:
		
							parent
							
								
									007774c81b
								
							
						
					
					
						commit
						ab69ca3fe2
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		|  | @ -20,7 +20,11 @@ def safe_pred(node): | ||||||
| 
 | 
 | ||||||
| # A to samé pro .father_of_first | # A to samé pro .father_of_first | ||||||
| def safe_father_of_first(node): | def safe_father_of_first(node): | ||||||
| 		return node.prev | 	first_brother = node | ||||||
|  | 	while safe_pred(first_brother) is not None: | ||||||
|  | 		first_brother = safe_pred(first_brother) | ||||||
|  | 	try: | ||||||
|  | 		return first_brother.father_of_first | ||||||
| 	except ObjectDoesNotExist: | 	except ObjectDoesNotExist: | ||||||
| 		return None | 		return None | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel 'LEdoian' Turinsky
						Pavel 'LEdoian' Turinsky