Changeset 33028

Show
Ignore:
Timestamp:
05/02/09 22:29:49 (4 years ago)
Author:
msakamoto-sf
Message:

implements hostname limitation.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/python/image_collector/image_collector.py

    r33027 r33028  
    8585 
    8686  --hostnames <hostnames> :  
    87     restrict hostnames for image url. 
     87    limit hostnames for image url. 
    8888    separate by space for multiple hostnames. 
    8989    ex:) --hostnames "a.com b.com c.com" 
     
    311311    use_https = True 
    312312 
     313  hostname_ok = False 
     314  if 0 == len(appconfig['hostnames']): 
     315    hostname_ok = True 
     316  else: 
     317    for host in appconfig['hostnames']: 
     318      if 0 <= parts.netloc.find(host): 
     319        hostname_ok = True 
     320        break 
     321 
     322  if not hostname_ok: 
     323    log.info("'%s' doesn't match limited hostnames %s" % 
     324        (url, appconfig['hostnames'])) 
     325    continue 
     326 
    313327  path = parts.path 
    314328  if re_texts.match(path):