mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Close issue 3437 - missing state change when Allow lines are processed.
Adds test cases which use Allow: as well.
This commit is contained in:
		
							parent
							
								
									4b99e9b479
								
							
						
					
					
						commit
						1ef19f0de1
					
				
					 2 changed files with 74 additions and 0 deletions
				
			
		|  | @ -76,6 +76,10 @@ def parse(self, lines): | |||
|         """parse the input lines from a robots.txt file. | ||||
|            We allow that a user-agent: line is not preceded by | ||||
|            one or more blank lines.""" | ||||
|         # states: | ||||
|         #   0: start state | ||||
|         #   1: saw user-agent line | ||||
|         #   2: saw an allow or disallow line | ||||
|         state = 0 | ||||
|         linenumber = 0 | ||||
|         entry = Entry() | ||||
|  | @ -114,6 +118,7 @@ def parse(self, lines): | |||
|                 elif line[0] == "allow": | ||||
|                     if state != 0: | ||||
|                         entry.rulelines.append(RuleLine(line[1], True)) | ||||
|                         state = 2 | ||||
|         if state == 2: | ||||
|             self.entries.append(entry) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Skip Montanaro
						Skip Montanaro