Changeset 9633 for main/waeup.kofa/trunk/src/waeup/kofa/reports.py
- Timestamp:
- 14 Nov 2012, 18:40:59 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/reports.py
r9510 r9633 44 44 """not when any output was created.""") 45 45 46 title = schema.TextLine( 47 title = u"A human readable short description for a report.", 48 default = u'Untitled', 49 ) 50 51 description = schema.Text( 52 title = u"A human readable text describing a report.", 53 default = u'No description' 54 ) 55 46 56 def create_pdf(): 47 57 """Generate a PDF copy. … … 121 131 """ 122 132 133 def get_report_jobs_description(user_id=None): 134 """Get running/completed report jobs fur ?user_id` as list of tuples. 135 136 Each tuple holds ``<job_id>, <description>, 137 <status_translated>`` in that order, where ``<description>`` 138 is a human readable description of the report run and 139 ``<status_translated>`` is the report jobs' status 140 (translated). 141 """ 142 123 143 def delete_report_entry(entry): 124 144 """Delete the report job denoted by `entry`. … … 162 182 class Report(object): 163 183 creation_dt = None 184 185 @property 186 def title(self): 187 return _(u'A report') 188 189 @property 190 def description(self): 191 return _(u'A dummy report') 164 192 165 193 def __init__(self, args=[], kwargs={}): … … 170 198 def create_pdf(self): 171 199 raise NotImplementedError() 200 201 def __repr__(self): 202 return 'Report(args=%r, kwargs=%r)' % (self.args, self.kwargs) 203 172 204 173 205 @implementer(IReportGenerator) … … 266 298 str_repr = '(' + str_repr + ')' 267 299 try: 268 generator = queryUtility(300 generator = getUtility( 269 301 IReportGenerator, name=self._generator_name) 270 name = generator. name302 name = generator.title 271 303 except: 272 name = _(' Invalid Report Generator')304 name = _('Unregistered Report Generator') 273 305 return name + ' ' + str_repr 274 306 … … 351 383 return result 352 384 385 def get_report_jobs_description(self, user_id=None): 386 """Get running/completed report jobs fur ?user_id` as list of tuples. 387 388 Each tuple holds ``<job_id>, <description>, 389 <status_translated>`` in that order, where ``<description>`` 390 is a human readable description of the report run and 391 ``<status_translated>`` is the report jobs' status 392 (translated). 393 """ 394 entries = self.get_running_report_jobs(user_id) 395 result = [] 396 for (job_id, gen_name, user_name) in entries: 397 manager = getUtility(IJobManager) 398 job = manager.get(job_id) 399 status = JOB_STATUS_MAP.get(job.status, job.status)[1] 400 if not hasattr(job, 'description'): 401 continue 402 result.append((job_id, job.description, status),) 403 return result 404 353 405 def delete_report_entry(self, entry): 354 406 """Delete the report job denoted by `entry`.
Note: See TracChangeset for help on using the changeset viewer.