Changeset 5949 for main/waeup.sirp/trunk
- Timestamp:
- 15 Apr 2011, 06:03:44 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/pages.py
r5948 r5949 1100 1100 def addCertificate(self, **data): 1101 1101 certificate = createObject(u'waeup.Certificate') 1102 try: 1103 self.applyData(certificate, **data) 1104 except NoTransitionAvailableError: 1105 self.status = Invalid('Review state cannot be changed to ' 1106 'requested state: no such transition ' 1107 'available in workflow.') 1108 return 1102 self.applyData(certificate, **data) 1103 1104 #try: 1105 # self.applyData(certificate, **data) 1106 #except NoTransitionAvailableError: 1107 # self.status = Invalid('Review state cannot be changed to ' 1108 # 'requested state: no such transition ' 1109 # 'available in workflow.') 1110 # return 1111 1109 1112 try: 1110 1113 self.context.certificates.addCertificate(certificate) … … 1244 1247 @grok.action('Save') 1245 1248 def save(self, **data): 1246 try: 1247 self.applyData(self.context, **data) 1248 except NoTransitionAvailableError: 1249 self.status = Invalid('Review state cannot be changed to ' 1250 'requested state: no such transition ' 1251 'available in workflow.') 1252 return 1249 self.applyData(self.context, **data) 1250 1251 #try: 1252 # self.applyData(self.context, **data) 1253 #except NoTransitionAvailableError: 1254 # self.status = Invalid('Review state cannot be changed to ' 1255 # 'requested state: no such transition ' 1256 # 'available in workflow.') 1257 #return 1253 1258 1254 1259 @grok.action('Save and return') 1255 1260 def saveAndReturn(self, **data): 1256 try: 1257 self.applyData(self.context, **data) 1258 except NoTransitionAvailableError: 1259 self.status = Invalid('Review state cannot be changed to ' 1260 'requested state: no such transition ' 1261 'available in workflow.') 1262 return 1261 self.applyData(self.context, **data) 1262 1263 #try: 1264 # self.applyData(self.context, **data) 1265 #except NoTransitionAvailableError: 1266 # self.status = Invalid('Review state cannot be changed to ' 1267 # 'requested state: no such transition ' 1268 # 'available in workflow.') 1269 # return 1270 1263 1271 self.redirect(self.url(self.context)) 1264 1272 return -
main/waeup.sirp/trunk/src/waeup/sirp/university/certificate.py
r5947 r5949 30 30 self.application_category = application_category 31 31 # Initialize workflow state... 32 self.setReviewState('unchecked')32 # self.setReviewState('unchecked') 33 33 34 def check(self):35 """Set Review State to ``checked``.36 """37 self.setReviewState(state='checked')34 #def check(self): 35 # """Set Review State to ``checked``. 36 # """ 37 # self.setReviewState(state='checked') 38 38 39 def getReviewState(self):40 return IWorkflowState(self).getState()39 #def getReviewState(self): 40 # return IWorkflowState(self).getState() 41 41 42 def setReviewState(self, state=None):43 """Try to set new state.42 #def setReviewState(self, state=None): 43 # """Try to set new state. 44 44 45 Instead of simply setting a value, we fire a transition of a46 workflow. This might fail if, for instance, the required state47 is not part of the workflow or unreachable from current state.48 """49 if state == self.getReviewState():50 # Accept staying in the same state, even if workflow does51 # not allow this.52 return53 info = IWorkflowInfo(self)54 info.fireTransitionToward(state)55 return45 # Instead of simply setting a value, we fire a transition of a 46 # workflow. This might fail if, for instance, the required state 47 # is not part of the workflow or unreachable from current state. 48 # """ 49 # if state == self.getReviewState(): 50 # # Accept staying in the same state, even if workflow does 51 # # not allow this. 52 # return 53 # info = IWorkflowInfo(self) 54 # info.fireTransitionToward(state) 55 # return 56 56 57 review_state = property(getReviewState, setReviewState)57 #review_state = property(getReviewState, setReviewState) 58 58 59 59 def addCourseRef(self, course, level=100, core_or_elective=True): -
main/waeup.sirp/trunk/src/waeup/sirp/university/certificate.txt
r5947 r5949 58 58 u'NA' 59 59 60 .. attribute:: review_state61 62 The review state can have one of the ``checking`` states defined63 in the WAeUP workflow. These are at least the states ``checked``64 and ``unchecked``. After a certificate is created, the review65 state is ``unchecked``:66 67 >>> mycertificate.review_state68 'unchecked'69 70 .. seealso::71 :meth:`Certificate.check` -- mark a certificate as ``checked``72 73 60 74 61 .. attribute:: study_mode … … 108 95 109 96 .. XXX: This is not a proper description 110 111 112 .. method:: check()113 114 Mark a certificate instance's review state as ``checked``:115 116 >>> mycertificate.review_state117 'unchecked'118 119 >>> mycertificate.check()120 >>> mycertificate.review_state121 'checked'122 123 We cannot uncheck a certificate:124 125 >>> mycertificate.review_state = 'unchecked'126 Traceback (most recent call last):127 ...128 NoTransitionAvailableError129 130 The only states accepted at all are ``checked`` and131 ``unchecked``. If we want to set something else this won't work:132 133 >>> mycertificate.review_state = 'nonsense'134 Traceback (most recent call last):135 ...136 NoTransitionAvailableError137 138 97 139 98 .. method:: addCourseRef(course[, level=100,[ core_or_elective=True]]) -
main/waeup.sirp/trunk/src/waeup/sirp/university/interfaces.py
r5948 r5949 144 144 ) 145 145 146 review_state = schema.Choice(147 title = u'Review State',148 default = 'unchecked',149 values = ['unchecked', 'checked']150 )146 #review_state = schema.Choice( 147 # title = u'Review State', 148 # default = 'unchecked', 149 # values = ['unchecked', 'checked'] 150 # ) 151 151 152 152 title = schema.TextLine( … … 171 171 172 172 application_category = schema.TextLine( 173 title = u' aApplication Category',173 title = u'Application Category', 174 174 required = False, 175 175 )
Note: See TracChangeset for help on using the changeset viewer.