Replying to myself,
there were a leftover of my test paths, so the patch could not be
applied. Please discard the previous patch. I attach my correction.
Sorry,
Ferran
WebUser: allow no apache password and group files
* Check whether apache password and group file exists before trying to
open the file to prevent an error when creating tables.
---
lib/python/invenio/webuser.py | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
Index: invenio/lib/python/invenio/webuser.py
===================================================================
--- invenio.orig/lib/python/invenio/webuser.py 2009-05-20 16:21:34.000000000 +0200
+++ invenio/lib/python/invenio/webuser.py 2009-05-20 16:29:03.000000000 +0200
@@ -1041,10 +1041,11 @@
def _load_apache_password_file(apache_password_file=CFG_APACHE_PASSWORD_FILE):
ret = {}
- for row in open(os.path.join(CFG_TMPDIR, apache_password_file)):
- row = row.split(':')
- if len(row) == 2:
- ret[row[0].strip()] = row[1].strip()
+ if apache_password_file:
+ for row in open(os.path.join(CFG_TMPDIR, apache_password_file)):
+ row = row.split(':')
+ if len(row) == 2:
+ ret[row[0].strip()] = row[1].strip()
return ret
_apache_passwords = _load_apache_password_file()
@@ -1060,16 +1061,17 @@
def _load_apache_group_file(apache_group_file=CFG_APACHE_GROUP_FILE):
ret = {}
- for row in open(os.path.join(CFG_TMPDIR, apache_group_file)):
- row = row.split(':')
- if len(row) == 2:
- group = row[0].strip()
- users = row[1].strip().split(' ')
- for user in users:
- user = user.strip()
- if user not in ret:
- ret[user] = []
- ret[user].append(group)
+ if apache_group_file:
+ for row in open(os.path.join(CFG_TMPDIR, apache_group_file)):
+ row = row.split(':')
+ if len(row) == 2:
+ group = row[0].strip()
+ users = row[1].strip().split(' ')
+ for user in users:
+ user = user.strip()
+ if user not in ret:
+ ret[user] = []
+ ret[user].append(group)
return ret
_apache_groups = _load_apache_group_file()