Changeset 6915 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 20 Oct 2011, 17:14:37 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/interfaces.py
r6744 r6915 36 36 from waeup.sirp.image import createWAeUPImageFile 37 37 from waeup.sirp.image.schema import ImageFile 38 from waeup.sirp.interfaces import IWAeUPObject 38 from waeup.sirp.interfaces import IWAeUPObject, year_range 39 39 from waeup.sirp.university.vocabularies import application_categories 40 40 from waeup.sirp.students.vocabularies import ( 41 year_range,lgas_vocab, CertificateSource, GenderSource,41 lgas_vocab, CertificateSource, GenderSource, 42 42 ) 43 43 from waeup.sirp.applicants.vocabularies import ( -
main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py
r6907 r6915 2 2 ## interfaces.py 3 3 import os 4 from datetime import datetime 4 5 from hurry.workflow.interfaces import IWorkflow, IWorkflowInfo 5 6 from zc.sourcefactory.basic import BasicSourceFactory … … 13 14 os.path.dirname(__file__), 'frontpage.rst'), 'rb').read() 14 15 16 def SimpleWAeUPVocabulary(*terms): 17 """A well-buildt vocabulary provides terms with a value, token and 18 title for each term 19 """ 20 return SimpleVocabulary([ 21 SimpleTerm(value, value, title) for title, value in terms]) 22 23 def year_range(): 24 curr_year = datetime.now().year 25 return range(curr_year - 2, curr_year + 5) 26 27 def academic_sessions(): 28 curr_year = datetime.now().year 29 year_range = range(curr_year - 10, curr_year + 2) 30 return [('%s/%s' % (year,year+1), year) for year in year_range] 31 32 academic_sessions_vocab = SimpleWAeUPVocabulary(*academic_sessions()) 33 15 34 class FatalCSVError(Exception): 16 35 """Some row could not be processed. … … 32 51 def __str__(self): 33 52 return '%r' % self.msg 34 35 def SimpleWAeUPVocabulary(*terms):36 """A well-buildt vocabulary provides terms with a value, token and37 title for each term38 """39 return SimpleVocabulary([40 SimpleTerm(value, value, title) for title, value in terms])41 53 42 54 class RoleSource(BasicSourceFactory): … … 216 228 217 229 class ISessionConfiguration(IWAeUPObject): 218 """A container for session configuration objects. 219 """ 230 """A session configuration object. 231 """ 232 233 academic_session = schema.Choice( 234 title = u'Academic Session', 235 source = academic_sessions_vocab, 236 default = None, 237 required = True, 238 readonly = True, 239 ) 240 241 fee_1 = schema.Int( 242 title = u'School Fee', 243 default = 0, 244 ) 220 245 221 246 class IDataCenter(IWAeUPObject): -
main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
r6896 r6915 4 4 from zope.interface.exceptions import Invalid 5 5 from zope import schema 6 from waeup.sirp.interfaces import IWAeUPObject 6 from waeup.sirp.interfaces import IWAeUPObject, academic_sessions_vocab 7 7 from waeup.sirp.schema import TextLineChoice 8 8 from waeup.sirp.university.vocabularies import CourseSource, study_modes -
main/waeup.sirp/trunk/src/waeup/sirp/students/utils.py
r6898 r6915 3 3 4 4 from random import SystemRandom as r 5 from waeup.sirp. students.vocabularies import academic_sessions_vocab5 from waeup.sirp.interfaces import academic_sessions_vocab 6 6 7 7 def generate_student_id(students,letter): -
main/waeup.sirp/trunk/src/waeup/sirp/students/vocabularies.py
r6804 r6915 1 1 """Vocabularies and sources for the student section. 2 2 """ 3 from datetime import datetime4 3 from zope.component import getUtility, queryUtility 5 4 from zope.catalog.interfaces import ICatalog … … 9 8 from zc.sourcefactory.basic import BasicSourceFactory 10 9 from zc.sourcefactory.contextual import BasicContextualSourceFactory 11 from waeup.sirp.interfaces import SimpleWAeUPVocabulary 10 from waeup.sirp.interfaces import SimpleWAeUPVocabulary, academic_sessions_vocab 12 11 from waeup.sirp.students.lgas import LGAS 13 12 from waeup.sirp.university.vocabularies import course_levels 14 15 16 17 def year_range():18 curr_year = datetime.now().year19 return range(curr_year - 2, curr_year + 5)20 21 def academic_sessions():22 curr_year = datetime.now().year23 year_range = range(curr_year - 10, curr_year + 2)24 return [('%s/%s' % (year,year+1), year) for year in year_range]25 26 academic_sessions_vocab = SimpleWAeUPVocabulary(*academic_sessions())27 13 28 14 lgas_vocab = SimpleWAeUPVocabulary(
Note: See TracChangeset for help on using the changeset viewer.