Changeset 8472 for main/waeup.kofa/trunk/src
- Timestamp:
- 20 May 2012, 09:57:09 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/batchprocessing.txt
r8372 r8472 298 298 >>> open('certificates.csv', 'wb').write( 299 299 ... """code,faculty_code,department_code,title,study_mode,start_level,end_level,application_category 300 ... CERT1,FAC1,DEP1,Certificate 1, ug_ft,100,300,basic300 ... CERT1,FAC1,DEP1,Certificate 1,pg_ft,999,999,basic 301 301 ... CERT2,FAC1,DEP1,Certificate 2,ug_ft,200,300,cest 302 302 ... """) -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
r8471 r8472 412 412 @property 413 413 def form_fields(self): 414 cm = getattr(self.context,'current_mode', None) 415 if cm is not None and cm.startswith('pg'): 414 if self.context.is_postgrad: 416 415 form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked') 417 416 else: … … 434 433 @property 435 434 def form_fields(self): 436 cm = getattr(self.context,'current_mode', None) 437 if cm is not None and cm.startswith('pg'): 435 if self.context.is_postgrad: 438 436 form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked') 439 437 else: … … 478 476 @property 479 477 def form_fields(self): 480 cm = getattr(self.context,'current_mode', None) 481 if cm is not None and cm.startswith('pg'): 478 if self.context.is_postgrad: 482 479 form_fields = grok.AutoFields(IPGStudentClearance) 483 480 else: … … 1621 1618 @property 1622 1619 def form_fields(self): 1623 cm = getattr(self.context,'current_mode', None) 1624 if cm is not None and cm.startswith('pg'): 1620 if self.context.is_postgrad: 1625 1621 form_fields = grok.AutoFields(IPGStudentClearance).omit('clearance_locked') 1626 1622 else: -
main/waeup.kofa/trunk/src/waeup/kofa/students/student.py
r8452 r8472 133 133 if certificate is not None: 134 134 return certificate.study_mode 135 return 135 return None 136 137 @property 138 def is_postgrad(self): 139 is_postgrad = getattr( 140 self.get('studycourse', None), 'is_postgrad', False) 141 return is_postgrad 136 142 137 143 # Set all attributes of Student required in IStudent as field -
main/waeup.kofa/trunk/src/waeup/kofa/students/studycourse.py
r8471 r8472 48 48 return True 49 49 if self.getStudent().state == PAID \ 50 and self.getStudent(). current_mode.startswith('pg'):50 and self.getStudent().is_postgrad: 51 51 return True 52 52 return False … … 105 105 return 106 106 107 @property 108 def is_postgrad(self): 109 cert = getattr(self, 'certificate', None) 110 if cert is not None: 111 return cert.study_mode.startswith('pg') 112 #return cert.start_level == 999 or cert.end_level == 999 113 return False 114 107 115 StudentStudyCourse = attrs_to_fields(StudentStudyCourse) 108 116 -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r8471 r8472 1837 1837 self.assertFalse('Employer' in self.browser.contents) 1838 1838 # Now we change the study mode of the certificate and a different 1839 # interface is used by clearance views 1839 # interface is used by clearance views. 1840 1840 self.certificate.study_mode = 'pg_ft' 1841 # Invariants are not being checked here?! 1842 self.certificate.end_level = 100 1841 1843 self.browser.open(self.clearance_path) 1842 1844 self.assertTrue('Employer' in self.browser.contents) -
main/waeup.kofa/trunk/src/waeup/kofa/students/utils.py
r8471 r8472 278 278 details['p_session'], details[ 279 279 'p_level'] = self.getReturningData(student) 280 elif student. current_mode.startswith('pg')and student.state == PAID:280 elif student.is_postgrad and student.state == PAID: 281 281 # Returning postgraduate students also pay for the next session 282 282 # but their level always remains the same. -
main/waeup.kofa/trunk/src/waeup/kofa/university/interfaces.py
r8299 r8472 20 20 21 21 from zope import schema 22 from zope.interface import Attribute 22 from zope.interface import Attribute, invariant, Invalid 23 23 from waeup.kofa.interfaces import (IKofaObject, IKofaContainer) 24 24 from waeup.kofa.interfaces import MessageFactory as _ … … 245 245 """ 246 246 247 @invariant 248 def check_pg_conditions(cert): 249 if cert.start_level == 999 and not cert.end_level == 999: 250 raise Invalid(_("Start level and end level must correspond.")) 251 if cert.end_level == 999 and not cert.start_level == 999: 252 raise Invalid(_("Start level and end level must correspond.")) 253 if cert.study_mode.startswith('pg') and not cert.start_level == 999: 254 raise Invalid(_( 255 "Study mode, start level and end level must correspond.")) 256 if cert.start_level == 999 and not cert.study_mode.startswith('pg'): 257 raise Invalid(_( 258 "Study mode, start level and end level must correspond.")) 259 260 247 261 class ICertificateAdd(ICertificate): 248 262 """Representation of a certificate.
Note: See TracChangeset for help on using the changeset viewer.