Return reach of host h, as defined by RFC 2965, section 1. The reach R of a host name H is defined as follows: * If - H is the host domain name of a host; and, - H has the form A.B; and - A has no embedded (that is, interior) dots; and -
(h)
| 690 | return path |
| 691 | |
| 692 | def reach(h): |
| 693 | """Return reach of host h, as defined by RFC 2965, section 1. |
| 694 | |
| 695 | The reach R of a host name H is defined as follows: |
| 696 | |
| 697 | * If |
| 698 | |
| 699 | - H is the host domain name of a host; and, |
| 700 | |
| 701 | - H has the form A.B; and |
| 702 | |
| 703 | - A has no embedded (that is, interior) dots; and |
| 704 | |
| 705 | - B has at least one embedded dot, or B is the string "local". |
| 706 | then the reach of H is .B. |
| 707 | |
| 708 | * Otherwise, the reach of H is H. |
| 709 | |
| 710 | >>> reach("www.acme.com") |
| 711 | '.acme.com' |
| 712 | >>> reach("acme.com") |
| 713 | 'acme.com' |
| 714 | >>> reach("acme.local") |
| 715 | '.local' |
| 716 | |
| 717 | """ |
| 718 | i = h.find(".") |
| 719 | if i >= 0: |
| 720 | #a = h[:i] # this line is only here to show what a is |
| 721 | b = h[i+1:] |
| 722 | i = b.find(".") |
| 723 | if is_HDN(h) and (i >= 0 or b == "local"): |
| 724 | return "."+b |
| 725 | return h |
| 726 | |
| 727 | def is_third_party(request): |
| 728 | """ |
searching dependent graphs…