@@ -119,7 +119,7 @@ def __ldap_remove_member_from_group__(username, group):
119119 ldap_conn .modify_s (groupdn , ldap_modlist )
120120
121121
122- # @ldap_init_required
122+ @ldap_init_required
123123def __ldap_is_member_of_committee__ (username , committee ):
124124 ldap_results = ldap_conn .search_s (committee_search_ou , ldap .SCOPE_SUBTREE ,
125125 "(cn=%s)" % committee )
@@ -130,51 +130,49 @@ def __ldap_is_member_of_committee__(username, committee):
130130 [x .decode ('ascii' ) for x in ldap_results [0 ][1 ]['head' ]]
131131
132132
133- # @lru_cache(maxsize=1024)
133+ @lru_cache (maxsize = 1024 )
134134def ldap_get_housing_points (username ):
135135 return int (__ldap_get_field__ (username , 'housingPoints' ))
136136
137137
138- # @lru_cache(maxsize=1024)
139138def ldap_get_room_number (username ):
140139 roomno = __ldap_get_field__ (username , 'roomNumber' )
141140 if roomno is None :
142141 return "N/A"
143142 return roomno .decode ('utf-8' )
144143
145144
146- # @lru_cache(maxsize=1024)
145+ @lru_cache (maxsize = 1024 )
147146def ldap_get_active_members ():
148147 return [x for x in ldap_get_current_students ()
149148 if ldap_is_active (x ['uid' ][0 ].decode ('utf-8' ))]
150149
151150
152- # @lru_cache(maxsize=1024)
151+ @lru_cache (maxsize = 1024 )
153152def ldap_get_intro_members ():
154153 return [x for x in ldap_get_current_students ()
155154 if ldap_is_intromember (x ['uid' ][0 ].decode ('utf-8' ))]
156155
157156
158- # @lru_cache(maxsize=1024)
157+ @lru_cache (maxsize = 1024 )
159158def ldap_get_non_alumni_members ():
160159 return [x for x in ldap_get_current_students ()
161160 if ldap_is_alumni (x ['uid' ][0 ].decode ('utf-8' ))]
162161
163162
164- # @lru_cache(maxsize=1024)
163+ @lru_cache (maxsize = 1024 )
165164def ldap_get_onfloor_members ():
166165 return [x for x in ldap_get_current_students ()
167166 if ldap_is_onfloor (x ['uid' ][0 ].decode ('utf-8' ))]
168167
169168
170- # @lru_cache(maxsize=1024)
169+ @lru_cache (maxsize = 1024 )
171170def ldap_get_current_students ():
172171 return [x [1 ]
173172 for x in __ldap_get_members__ ()[1 :]
174173 if ldap_is_current_student (str (str (x [0 ]).split ("," )[0 ]).split ("=" )[1 ])]
175174
176175
177- # @lru_cache(maxsize=1024)
178176def ldap_is_active (username ):
179177 return __ldap_is_member_of_group__ (username , 'active' )
180178
0 commit comments