Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/robotparser.py

    r2 r391  
    6969        if "*" in entry.useragents:
    7070            # the default entry is considered last
    71             self.default_entry = entry
     71            if self.default_entry is None:
     72                # the first default entry wins
     73                self.default_entry = entry
    7274        else:
    7375            self.entries.append(entry)
     
    121123                        state = 2
    122124        if state == 2:
    123             self.entries.append(entry)
     125            self._add_entry(entry)
    124126
    125127
     
    132134        # search for given user agent matches
    133135        # the first match counts
    134         url = urllib.quote(urlparse.urlparse(urllib.unquote(url))[2]) or "/"
     136        parsed_url = urlparse.urlparse(urllib.unquote(url))
     137        url = urlparse.urlunparse(('', '', parsed_url.path,
     138            parsed_url.params, parsed_url.query, parsed_url.fragment))
     139        url = urllib.quote(url)
     140        if not url:
     141            url = "/"
    135142        for entry in self.entries:
    136143            if entry.applies_to(useragent):
     
    154161            # an empty value means allow all
    155162            allowance = True
     163        path = urlparse.urlunparse(urlparse.urlparse(path))
    156164        self.path = urllib.quote(path)
    157165        self.allowance = allowance
Note: See TracChangeset for help on using the changeset viewer.