homes: plus de généricité & /home-adh/x/xlogin
This commit is contained in:
parent
de45237b50
commit
20a6ee6afb
6 changed files with 15 additions and 14 deletions
|
@ -11,9 +11,10 @@ robots_file = '/usr/scripts/var/perso/robots.txt'
|
|||
|
||||
robots = collections.defaultdict(lambda:collections.defaultdict(list))
|
||||
def add_robots(user, robots):
|
||||
if os.path.exists('/home/%s/www/robots.txt' % user):
|
||||
robots_path = os.expanduser('~%s/www/robots.txt' % user)
|
||||
if os.path.exists(robots_path):
|
||||
rp = robotparser.RobotFileParser()
|
||||
rp.parse(open('/home/%s/www/robots.txt' % user))
|
||||
rp.parse(open(robots_path))
|
||||
for entry in ([rp.default_entry] if rp.default_entry else []) + rp.entries:
|
||||
for user_agent in entry.useragents:
|
||||
for rule in entry.rulelines:
|
||||
|
@ -31,7 +32,7 @@ def write_robots(file, robots):
|
|||
f.write("\n")
|
||||
|
||||
def get_users():
|
||||
return os.listdir('/home/')
|
||||
return os.listdir('/home/mail')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue