Changeset 7795 for main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py
- Timestamp:
- 8 Mar 2012, 03:30:30 (13 years ago)
- Location:
- main/waeup.sirp/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk
- Property svn:mergeinfo changed
/main/waeup.sirp/branches/ulif-schoolgrades (added) merged: 7761-7774,7778-7794
- Property svn:mergeinfo changed
-
main/waeup.sirp/trunk/src/waeup/sirp/interfaces.py
r7730 r7795 31 31 from zope.container.interfaces import INameChooser 32 32 from zope.interface import Interface, Attribute, implements 33 from zope.schema.interfaces import IObject 33 34 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm 34 35 … … 79 80 ) 80 81 82 SUBJECTS = dict(math=_(u'Math'), 83 bio=_(u'Biology'), 84 eng=_(u'English'), 85 ) 86 class SubjectSource(BasicSourceFactory): 87 def getValues(self): 88 return sorted(SUBJECTS.keys()) 89 def getTitle(self, value): 90 return SUBJECTS.get(value, None) 91 92 GRADES = {'A':_(u'Very Good'), 93 'B':_(u'Good'), 94 'C':_(u'Satisfactory'), 95 'D':_(u'Sufficient'), 96 'E':_(u'Fail'), 97 } 98 class GradeSource(BasicSourceFactory): 99 def getValues(self): 100 return sorted(GRADES.keys()) 101 def getTitle(self, value): 102 return GRADES.get(value, None) 103 81 104 # Define a valiation method for email addresses 82 105 class NotAnEmailAddress(schema.ValidationError): … … 145 168 return value 146 169 170 class IResultEntry(Interface): 171 """A school grade entry. 172 """ 173 subject = schema.Choice( 174 title = _(u'Subject'), 175 source = SubjectSource(), 176 ) 177 grade = schema.Choice( 178 title = _(u'Grade'), 179 source = GradeSource(), 180 ) 181 182 class IResultEntryField(IObject): 183 """A zope.schema-like field for usage in interfaces. 184 185 Marker interface to distuingish result entries from ordinary 186 object fields. Needed for registration of widgets. 187 """ 188 147 189 class ISIRPUtils(Interface): 148 190 """A collection of methods which are subject to customization. … … 970 1012 required = True, 971 1013 ) 972
Note: See TracChangeset for help on using the changeset viewer.