Changeset 7240 for main/waeup.sirp/trunk/src/waeup/sirp/browser/layout.py
- Timestamp:
- 30 Nov 2011, 23:13:26 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/layout.py
r7195 r7240 32 32 from waeup.sirp.browser.theming import get_all_themes, WAeUPThemeGray1 33 33 from waeup.sirp.students.interfaces import IStudentNavigation 34 from waeup.sirp.applicants.interfaces import IApplicant 34 35 from waeup.sirp.authentication import get_principal_role_manager 35 36 … … 163 164 if usertitle == 'Unauthenticated User': 164 165 return u'Anonymous User' 165 elif usertitle == 'Applicant':166 return self.request.principal.id167 166 return usertitle 168 167 … … 172 171 userid = self.request.principal.id 173 172 return userid 173 174 def isStudent(self): 175 usertype = getattr(self.request.principal, 'user_type', None) 176 if not usertype: 177 return False 178 return self.request.principal.user_type == 'student' 179 180 def isApplicant(self): 181 usertype = getattr(self.request.principal, 'user_type', None) 182 if not usertype: 183 return False 184 return self.request.principal.user_type == 'applicant' 174 185 175 186 def getStudentName(self): … … 180 191 return 181 192 182 def isStudent(self): 183 prm = get_principal_role_manager() 184 roles = [x[0] for x in 185 prm.getRolesForPrincipal(self.request.principal.id)] 186 return 'waeup.Student' in roles 193 def getApplicantName(self): 194 """Return the applicant name. 195 """ 196 if IApplicant.providedBy(self.context): 197 return self.context.fullname 198 return 187 199 188 200 def update(self): … … 209 221 210 222 def render(self): 211 if self.isStudent() or not self.isAuthenticated():223 if self.isStudent() or self.isApplicant() or not self.isAuthenticated(): 212 224 return self.studenttemp.render(self) 213 225 return self.stafftemp.render(self)
Note: See TracChangeset for help on using the changeset viewer.