Changeset 2f6820c for fedd/federation
- Timestamp:
- May 28, 2010 3:40:47 AM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 2c1fd21
- Parents:
- 5bf359d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/federation/access.py
r5bf359d r2f6820c 129 129 """ 130 130 Read an access DB with filename config of the form: 131 (id, id, id) -> something132 where the ids can be fedids, strings, or <any> or <none> and somthing133 is any set of charcters. The hash self.access is populated with134 mappings from those triples to the results of access_obj being called135 on the remainder of the line. If access_obj is not given, the string136 itself is entered in the hash. Additionally, a triple with <any> and137 <none> mapped to None is entered in self.auth with the attribute138 "access".131 (id, id, id) -> attribute, something 132 where the ids can be fedids, strings, or <any> or <none>, attribute is 133 the attribute to assign , and something is any set of charcters. The 134 hash self.access is populated with mappings from those triples to the 135 results of access_obj being called on the remainder of the line (if 136 present). If access_obj is not given, the string itself is entered in 137 the hash. Additionally, a triple with <any> and <none> mapped to None 138 is entered in self.auth with the attribute given. 139 139 140 140 Parsing errors result in a self.parse_error exception being raised. … … 146 146 key_name = "(<ANY>|<NONE>|"+fedid_expr + "|"+ name_expr + ")" 147 147 access_re = re.compile('\('+key_name+'\s*,\s*'+key_name+'\s*,\s*'+ 148 key_name+'\s*\)\s*->\s*( .*)', re.IGNORECASE)148 key_name+'\s*\)\s*->\s*([^,]+)\s*(.*)', re.IGNORECASE) 149 149 150 150 def parse_name(n): … … 158 158 else: 159 159 return n 160 def strip_comma(s): 161 s = s.strip() 162 if s.startswith(','): 163 s = s[1:].strip() 164 return s 160 165 161 166 if access_obj is None: … … 175 180 access_key = tuple([ parse_name(x) \ 176 181 for x in m.group(1,2,3)]) 182 attribute = m.group(4) 177 183 auth_key = tuple([ auth_name(x) for x in access_key]) 178 access_val = access_obj(m.group(4))179 180 self.access[access_key] = access_val181 self.auth.set_attribute(auth_key, "access")184 self.auth.set_attribute(auth_key, attribute) 185 if len(m.group(5)) > 0: 186 access_val = access_obj(strip_comma(m.group(5))) 187 self.access[access_key] = access_val 182 188 continue 183 189
Note: See TracChangeset
for help on using the changeset viewer.