OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 | 3 |
4 #### | 4 #### |
5 # Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu> | 5 # Copyright 2000 by Timothy O'Malley <timo@alum.mit.edu> |
6 # | 6 # |
7 # All Rights Reserved | 7 # All Rights Reserved |
8 # | 8 # |
9 # Permission to use, copy, modify, and distribute this software | 9 # Permission to use, copy, modify, and distribute this software |
10 # and its documentation for any purpose and without fee is hereby | 10 # and its documentation for any purpose and without fee is hereby |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 r"(?P<key>" # Start of group 'key' | 438 r"(?P<key>" # Start of group 'key' |
439 ""+ _LegalCharsPatt +"+?" # Any word of at least one letter, nongreedy | 439 ""+ _LegalCharsPatt +"+?" # Any word of at least one letter, nongreedy |
440 r")" # End of group 'key' | 440 r")" # End of group 'key' |
441 r"\s*=\s*" # Equal Sign | 441 r"\s*=\s*" # Equal Sign |
442 r"(?P<val>" # Start of group 'val' | 442 r"(?P<val>" # Start of group 'val' |
443 r'"(?:[^\\"]|\\.)*"' # Any doublequoted string | 443 r'"(?:[^\\"]|\\.)*"' # Any doublequoted string |
444 r"|" # or | 444 r"|" # or |
445 ""+ _LegalCharsPatt +"*" # Any word or empty string | 445 ""+ _LegalCharsPatt +"*" # Any word or empty string |
446 r")" # End of group 'val' | 446 r")" # End of group 'val' |
447 r"\s*;?" # Probably ending in a semi-colon | 447 r"\s*;?" # Probably ending in a semi-colon |
448 ) | 448 , re.ASCII) # May be removed if safe. |
449 | 449 |
450 | 450 |
451 # At long last, here is the cookie class. | 451 # At long last, here is the cookie class. |
452 # Using this class is almost just like using a dictionary. | 452 # Using this class is almost just like using a dictionary. |
453 # See this module's docstring for example usage. | 453 # See this module's docstring for example usage. |
454 # | 454 # |
455 class BaseCookie(dict): | 455 class BaseCookie(dict): |
456 # A container class for a set of Morsels | 456 # A container class for a set of Morsels |
457 # | 457 # |
458 | 458 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 579 |
580 # | 580 # |
581 ########################################################### | 581 ########################################################### |
582 | 582 |
583 def _test(): | 583 def _test(): |
584 import doctest, http.cookies | 584 import doctest, http.cookies |
585 return doctest.testmod(http.cookies) | 585 return doctest.testmod(http.cookies) |
586 | 586 |
587 if __name__ == "__main__": | 587 if __name__ == "__main__": |
588 _test() | 588 _test() |
OLD | NEW |