Changeset 5851 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 12 Mar 2011, 14:29:37 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r5850 r5851 245 245 text = 'Manage' 246 246 247 class ApplicantsContainerEditPage(WAeUPPage):248 """Manage/edit a container for regular applicants.249 """250 grok.context(IApplicantsContainer)251 grok.name('manage2')252 253 @property254 def title(self):255 return "Manage applicants container: %s" % getattr(256 self.context, '__name__', 'unnamed')257 258 @property259 def label(self):260 return self.title261 262 pnav = 3263 264 def update(self, CANCEL=None, SAVE=None,265 title=None, description=None, startdate=None, enddate=None):266 datepicker.need()267 268 if CANCEL is not None:269 self.redirect(self.url(self.context))270 return271 if SAVE is None:272 return273 self.context.title = title274 self.context.description = description275 try:276 self.context.startdate = datetime.strptime(startdate, '%Y-%m-%d')277 except ValueError:278 pass279 try:280 self.context.enddate = datetime.strptime(enddate, '%Y-%m-%d')281 except ValueError:282 pass283 self.flash('Data saved.')284 return285 286 def getFormattedDates(self):287 """Returns a dict with formatted start- and enddate.288 289 Returns dates of form ``YYYY-MM-DD`` based on the start and290 enddates of the context container. The result dict has291 format::292 293 { 'start': '<YYYY-MM-DD>',294 'end': '<YYYY-MM-DD>'}295 296 Each value can also be ``''`` (empty string) if unset.297 """298 start = ''299 if self.context.startdate is not None:300 start = datetime.strftime(self.context.startdate, '%Y-%m-%d')301 end = ''302 if self.context.enddate is not None:303 end = datetime.strftime(self.context.enddate, '%Y-%m-%d')304 return {'start' : start, 'end' : end }305 306 247 307 248 class ManageApplicantsContainer(WAeUPEditFormPage):
Note: See TracChangeset for help on using the changeset viewer.