Changeset 7681 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 22 Feb 2012, 21:14:09 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r7555 r7681 32 32 ISIRPObject, year_range, validate_email, academic_sessions_vocab) 33 33 from waeup.sirp.university.vocabularies import ( 34 application_categories, course_levels)34 course_levels, AppCatSource) 35 35 from waeup.sirp.students.vocabularies import ( 36 36 lgas_vocab, CertificateSource, GenderSource) … … 188 188 required = True, 189 189 default = None, 190 source = application_categories,190 source = AppCatSource(), 191 191 ) 192 192 -
main/waeup.sirp/trunk/src/waeup/sirp/browser/browser.txt
r7674 r7681 568 568 >>> ctrl = browser.getControl(name='form.semester') 569 569 >>> ctrl.options 570 [' 9', '1', '2', '3']570 ['1', '2', '3', '9'] 571 571 572 572 >>> ctrl.displayOptions 573 [' N/A', 'First Semester', 'Second Semester', 'Combined']573 ['First Semester', 'Second Semester', 'Combined', 'N/A'] 574 574 575 575 >>> ctrl.value = ['1'] -
main/waeup.sirp/trunk/src/waeup/sirp/locales/waeup.sirp.pot
r7680 r7681 15 15 msgstr "" 16 16 "Project-Id-Version: Development/Unknown\n" 17 "POT-Creation-Date: Wed Feb 22 12:23:01 2012\n"17 "POT-Creation-Date: Wed Feb 22 22:06:51 2012\n" 18 18 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 19 19 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 130 130 msgstr "" 131 131 132 #: waeup/sirp/objecthistory.py: 69132 #: waeup/sirp/objecthistory.py:73 133 133 msgid "by" 134 134 msgstr "" … … 290 290 msgstr "" 291 291 292 #: waeup/sirp/university/vocabularies.py:28 293 msgid "Pre-Studies" 294 msgstr "" 295 296 #: waeup/sirp/university/vocabularies.py:29 297 msgid "100 (Year 1)" 298 msgstr "" 299 300 #: waeup/sirp/university/vocabularies.py:30 301 msgid "200 (Year 2)" 302 msgstr "" 303 304 #: waeup/sirp/university/vocabularies.py:31 305 msgid "300 (Year 3)" 306 msgstr "" 307 308 #: waeup/sirp/university/vocabularies.py:32 309 msgid "400 (Year 4)" 310 msgstr "" 311 312 #: waeup/sirp/university/vocabularies.py:33 313 msgid "500 (Year 5)" 314 msgstr "" 315 316 #: waeup/sirp/university/vocabularies.py:34 317 msgid "600 (Year 6)" 318 msgstr "" 319 320 #: waeup/sirp/university/vocabularies.py:35 321 msgid "700 (Year 7)" 322 msgstr "" 323 324 #: waeup/sirp/university/vocabularies.py:36 325 msgid "800 (Year 8)" 326 msgstr "" 327 -
main/waeup.sirp/trunk/src/waeup/sirp/objecthistory.py
r7679 r7681 72 72 if portal_language != 'en': 73 73 by = translate(_('by'),'waeup.sirp',target_language=portal_language) 74 msg = '%s - %s %s %s' % (timestamp, msg, by, user)74 msg = u'%s - %s %s %s' % (timestamp, msg, by, user) 75 75 msgs.append(msg) 76 76 self._annotations[self.history_key] = msgs -
main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
r7671 r7681 44 44 FriendlyDateWidget, FriendlyDateDisplayWidget, 45 45 FriendlyDatetimeDisplayWidget) 46 from waeup.sirp.university.vocabularies import study_modes47 46 from waeup.sirp.students.interfaces import ( 48 47 IStudentsContainer, IStudent, IStudentClearance, … … 533 532 def current_mode(self): 534 533 if self.context.certificate is not None: 535 current_mode = study_modes.getTermByToken( 536 self.context.certificate.study_mode).title 537 return current_mode 534 studymodes_dict = getUtility(ISIRPUtils).getStudyModesDict() 535 return studymodes_dict[self.context.certificate.study_mode] 538 536 return 539 537 -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r7665 r7681 22 22 from zc.sourcefactory.contextual import BasicContextualSourceFactory 23 23 from waeup.sirp.interfaces import ( 24 ISIRPObject, academic_sessions_vocab, validate_email )24 ISIRPObject, academic_sessions_vocab, validate_email, ISIRPUtils) 25 25 from waeup.sirp.schema import TextLineChoice 26 from waeup.sirp.university.vocabularies import CourseSource, study_modes26 from waeup.sirp.university.vocabularies import CourseSource, StudyModeSource 27 27 from waeup.sirp.students.vocabularies import ( 28 28 CertificateSource, StudyLevelSource, … … 47 47 def getTitle(self, context, value): 48 48 return self.verdicts_dict[value] 49 49 50 50 51 class IStudentsUtils(Interface): … … 278 279 entry_mode = schema.Choice( 279 280 title = u'Entry Mode', 280 vocabulary = study_modes,281 source = StudyModeSource(), 281 282 default = u'ug_ft', 282 283 required = True, -
main/waeup.sirp/trunk/src/waeup/sirp/students/workflow.py
r7679 r7681 182 182 """Append message to student history and log file when transition happened. 183 183 184 184 Lock and unlock clearance form. 185 185 """ 186 186 -
main/waeup.sirp/trunk/src/waeup/sirp/university/__init__.py
r7333 r7681 2 2 from waeup.sirp.university.course import Course 3 3 from waeup.sirp.university.coursescontainer import CoursesContainer 4 from waeup.sirp.university.certificate import Certificate 5 from waeup.sirp.university.certificatescontainer import CertificatesContainer 4 6 from waeup.sirp.university.faculty import Faculty 7 from waeup.sirp.university.department import Department 5 8 from waeup.sirp.university.facultiescontainer import FacultiesContainer 6 9 __all__ = ( 7 'Course', 'CoursesContainer', 'Faculty', 'FacultiesContainer') 10 'Course', 'CoursesContainer', 11 'Certificate', 'CertificatesContainer', 12 'Faculty', 'FacultiesContainer', 'Department') -
main/waeup.sirp/trunk/src/waeup/sirp/university/department.py
r7334 r7681 19 19 """ 20 20 import grok 21 from zope.component import createObject22 21 from zope.component.interfaces import IFactory 23 22 from zope.interface import implementedBy 23 from zope.component import getUtility 24 from waeup.sirp.university.coursescontainer import CoursesContainer 25 from waeup.sirp.university.certificatescontainer import CertificatesContainer 26 from waeup.sirp.interfaces import ISIRPUtils 24 27 from waeup.sirp.university.interfaces import IDepartment, IDepartmentAdd 25 from waeup.sirp.university.vocabularies import inst_types26 28 27 29 class Department(grok.Container): … … 53 55 self.title_prefix = title_prefix 54 56 self.code = code 55 self.courses = createObject(u'waeup.CoursesContainer')57 self.courses = CoursesContainer() 56 58 self.courses.__parent__ = self 57 59 self.courses.__name__ = 'courses' 58 self.certificates = createObject(u'waeup.CertificatesContainer')60 self.certificates = CertificatesContainer() 59 61 self.certificates.__parent__ = self 60 62 self.certificates.__name__ = 'certificates' … … 71 73 72 74 def longtitle(self): 75 insttypes_dict = getUtility(ISIRPUtils).getInstTypeDict() 73 76 return "%s %s (%s)" % ( 74 inst _types.getTerm(self.title_prefix).title,77 insttypes_dict[self.title_prefix], 75 78 self.title, self.code) 76 79 -
main/waeup.sirp/trunk/src/waeup/sirp/university/faculty.py
r7334 r7681 22 22 from zope.component.interfaces import IFactory 23 23 from zope.interface import implementedBy 24 from zope.component import getUtility 25 from waeup.sirp.interfaces import ISIRPUtils 24 26 from waeup.sirp.university.interfaces import ( 25 27 IFaculty, IFacultyAdd, IDepartment) 26 from waeup.sirp.university.vocabularies import inst_types27 28 28 29 class Faculty(grok.Container): … … 60 61 61 62 def longtitle(self): 62 try: 63 result = "%s %s (%s)" % ( 64 inst_types.getTerm( 65 self.title_prefix).title, 66 self.title, self.code) 67 except: 68 result = "%s (%s)" % (self.title, self.code) 63 insttypes_dict = getUtility(ISIRPUtils).getInstTypeDict() 64 result = "%s %s (%s)" % ( 65 insttypes_dict[self.title_prefix], 66 self.title, self.code) 69 67 return result 70 68 -
main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py
r7670 r7681 26 26 from waeup.sirp.university.vocabularies import ( 27 27 course_levels, 28 semester,29 application_categories,30 study_modes,31 inst_types,32 28 CourseSource, 29 StudyModeSource, 30 AppCatSource, 31 InstTypeSource, 32 SemesterSource, 33 33 ) 34 34 … … 53 53 title = u'Name prefix', 54 54 default = u'faculty', 55 vocabulary = inst_types,55 source = InstTypeSource(), 56 56 required = True, 57 57 ) … … 100 100 title_prefix = schema.Choice( 101 101 title = u'Name prefix', 102 vocabulary = inst_types,102 source = InstTypeSource(), 103 103 default = u'department', 104 104 required = True, … … 166 166 title = u'Semester/Term', 167 167 default = 9, 168 vocabulary = semester,168 source = SemesterSource(), 169 169 required = True, 170 170 ) … … 206 206 study_mode = schema.Choice( 207 207 title = u'Study Mode', 208 vocabulary = study_modes,208 source = StudyModeSource(), 209 209 default = u'ug_ft', 210 210 required = True, … … 227 227 application_category = schema.Choice( 228 228 title = u'Application Category', 229 vocabulary = application_categories,229 source = AppCatSource(), 230 230 default = u'basic', 231 231 required = True, -
main/waeup.sirp/trunk/src/waeup/sirp/university/tests/test_faculty.py
r7195 r7681 22 22 import unittest 23 23 from zope.interface.verify import verifyObject, verifyClass 24 from waeup.sirp.university import Faculty 25 from waeup.sirp.university.interfaces import IFaculty 24 from waeup.sirp.university import Faculty, Department 25 from waeup.sirp.university.interfaces import IFaculty, IDepartment 26 26 27 class Faculty Tests(unittest.TestCase):27 class FacultyAndDepartmentTests(unittest.TestCase): 28 28 29 29 def test_ifaces(self): … … 32 32 verifyClass(IFaculty, Faculty) 33 33 verifyObject(IFaculty, fac) 34 dep = Department() 35 verifyClass(IDepartment, Department) 36 verifyObject(IDepartment, dep) 34 37 return 35 36 def test_longtitle(self):37 # Make sure we get a longtitle38 fac = Faculty()39 self.assertEqual(fac.longtitle(),40 u'Faculty of Unnamed Faculty (NA)')41 42 def test_longtitle_no_terms(self):43 # Make sure we get a longtitle also if no term for the title44 # prefix is available45 fac = Faculty()46 fac.title_prefix = 'Studio for' # Not a valid prefix47 self.assertEqual(fac.longtitle(),48 u'Unnamed Faculty (NA)') -
main/waeup.sirp/trunk/src/waeup/sirp/university/vocabularies.py
r7601 r7681 19 19 """ 20 20 from zc.sourcefactory.basic import BasicSourceFactory 21 from zc.sourcefactory.contextual import BasicContextualSourceFactory 21 22 from zope.catalog.interfaces import ICatalog 22 23 from zope.component import getUtility 23 from waeup.sirp.interfaces import SimpleSIRPVocabulary 24 from waeup.sirp.interfaces import SimpleSIRPVocabulary, ISIRPUtils 25 from waeup.sirp.interfaces import MessageFactory as _ 24 26 25 inst_types = SimpleSIRPVocabulary( 26 ('Faculty of','faculty'), 27 ('Department of','department'), 28 ('School of','school'), 29 ('School for','school_for'), 30 ('Institute of','institute'), 31 ('Office for','office'), 32 ('Centre for','centre'), 33 ('College','college'), 27 course_levels = SimpleSIRPVocabulary( 28 (_('Pre-Studies'),10), 29 (_('100 (Year 1)'),100), 30 (_('200 (Year 2)'),200), 31 (_('300 (Year 3)'),300), 32 (_('400 (Year 4)'),400), 33 (_('500 (Year 5)'),500), 34 (_('600 (Year 6)'),600), 35 (_('700 (Year 7)'),700), 36 (_('800 (Year 8)'),800), 34 37 ) 35 38 36 course_levels = SimpleSIRPVocabulary( 37 ('Pre-Studies', 10), 38 ('100 (Year 1)',100), 39 ('200 (Year 2)',200), 40 ('300 (Year 3)',300), 41 ('400 (Year 4)',400), 42 ('500 (Year 5)',500), 43 ('600 (Year 6)',600), 44 ('700 (Year 7)',700), 45 ('800 (Year 8)',800), 46 ) 39 class SemesterSource(BasicContextualSourceFactory): 40 """An institution type source delivers semester or term descriptors. 41 """ 42 def getValues(self, context): 43 self.semesters_dict = getUtility(ISIRPUtils).getSemesterDict() 44 return self.semesters_dict.keys() 47 45 48 semester = SimpleSIRPVocabulary( 49 ('N/A', 9), 50 ('First Semester', 1), 51 ('Second Semester', 2), 52 ('Combined', 3) 53 ) 46 def getToken(self, context, value): 47 return str(value) 54 48 55 application_categories = SimpleSIRPVocabulary( 56 ('PUME, PDE, PCE, PRENCE','basic'), 57 ('Part-Time, Diploma, Certificate','cest'), 58 ('Sandwich','sandwich'), 59 ('Postgraduate','pg'), 60 ('no application','no'), 61 ) 49 def getTitle(self, context, value): 50 return self.semesters_dict[value] 62 51 63 study_modes = SimpleSIRPVocabulary( 64 ('UME Full Time','ume_ft'), 65 ('Direct Entry Full Time','de_ft'), 66 ('Direct Entry Part Time','de_pt'), 67 ('Diploma Full Time','dp_ft'), 68 ('Diploma Part Time','dp_pt'), 69 ('Undergraduate Full Time','ug_ft'), 70 ('Undergraduate Part Time','ug_pt'), 71 ('Postgraduate Full Time','pg_ft'), 72 ('Postgraduate Part Time','pg_pt'), 73 ('Certificate Full Time','ct_ft'), 74 ('Certificate Part Time','ct_pt'), 75 ('Remedial','rm_ft'), 76 ('Remedial with deficiencies','rmd_ft'), 77 ('Post Higher Education Full Time','ph_ft'), 78 ('Joint Matriculation Full Time','jm_ft'), 79 ('Transfer Full Time','transfer_ft'), 80 ('Transfer Part Time','transfer_pt'), 81 ) 52 class InstTypeSource(BasicContextualSourceFactory): 53 """An institution type source delivers types of institutions 54 in the portal. 55 """ 56 def getValues(self, context): 57 self.insttypes_dict = getUtility(ISIRPUtils).getInstTypeDict() 58 return sorted(self.insttypes_dict.keys()) 59 60 def getToken(self, context, value): 61 return value 62 63 def getTitle(self, context, value): 64 return self.insttypes_dict[value] 65 66 class AppCatSource(BasicContextualSourceFactory): 67 """A application category source delivers all application categories 68 provided in the portal. 69 """ 70 def getValues(self, context): 71 self.appcats_dict = getUtility(ISIRPUtils).getAppCatDict() 72 return sorted(self.appcats_dict.keys()) 73 74 def getToken(self, context, value): 75 return value 76 77 def getTitle(self, context, value): 78 return self.appcats_dict[value] 79 80 class StudyModeSource(BasicContextualSourceFactory): 81 """A study modes source delivers all study modes provided 82 in the portal. 83 """ 84 def getValues(self, context): 85 self.studymodes_dict = getUtility(ISIRPUtils).getStudyModesDict() 86 return sorted(self.studymodes_dict.keys()) 87 88 def getToken(self, context, value): 89 return value 90 91 def getTitle(self, context, value): 92 return self.studymodes_dict[value] 82 93 83 94 class CourseSource(BasicSourceFactory): -
main/waeup.sirp/trunk/src/waeup/sirp/utils/utils.py
r7678 r7681 43 43 # (e.g. object histories). 44 44 PORTAL_LANGUAGE = 'en' 45 46 def getInstTypeDict(self): 47 """Provide a dictionary of study modes. 48 """ 49 return { 50 'faculty': 'Faculty of', 51 'department': 'Department of', 52 'school': 'School of', 53 'office': 'Office for', 54 'centre': 'Centre for', 55 'institute': 'Institute of', 56 'school_for': 'School for', 57 } 58 59 def getStudyModesDict(self): 60 """Provide a dictionary of study modes. 61 """ 62 return { 63 'rmd_ft': 'Remedial with deficiencies', 64 'dp_pt': 'Diploma Part Time', 65 'ct_ft': 'Certificate Full Time', 66 'dp_ft': 'Diploma Full Time', 67 'de_pt': 'Direct Entry Part Time', 68 'pg_ft': 'Postgraduate Full Time', 69 'pg_pt': 'Postgraduate Part Time', 70 'jm_ft': 'Joint Matriculation Full Time', 71 'ume_ft': 'UME Full Time', 72 'de_ft': 'Direct Entry Full Time', 73 'ph_ft': 'Post Higher Education Full Time', 74 'transfer_pt': 'Transfer Part Time', 75 'ug_pt': 'Undergraduate Part Time', 76 'transfer_ft': 'Transfer Full Time', 77 'ct_pt': 'Certificate Part Time', 78 'ug_ft': 'Undergraduate Full Time', 79 'rm_ft': 'Remedial' 80 } 81 82 def getAppCatDict(self): 83 """Provide a dictionary of study modes. 84 """ 85 return { 86 'basic': 'PUME, PDE, PCE, PRENCE', 87 'no': 'no application', 88 'pg': 'Postgraduate', 89 'sandwich': 'Sandwich', 90 'cest': 'Part-Time, Diploma, Certificate' 91 } 92 93 def getSemesterDict(self): 94 """Provide a dictionary of semester or trimester types. 95 """ 96 return { 97 1: 'First Semester', 98 2: 'Second Semester', 99 3: 'Combined', 100 9: 'N/A' 101 } 45 102 46 103 def sendContactForm(self,from_name,from_addr,rcpt_name,rcpt_addr,
Note: See TracChangeset for help on using the changeset viewer.