Mercurial > hg > MPIWGWeb
comparison MPIWGProjects_removed.py @ 227:a328c112e372
moved obsoleted getAllProjectsAndTagsAsCSV to MPIWGThesaurus.
author | casties |
---|---|
date | Wed, 30 Oct 2013 17:44:42 +0100 |
parents | 975a8d88e315 |
children |
comparison
equal
deleted
inserted
replaced
226:4f2ed4dc50e6 | 227:a328c112e372 |
---|---|
371 return [] | 371 return [] |
372 self._v_imageUrls = ret[0:] | 372 self._v_imageUrls = ret[0:] |
373 return ret | 373 return ret |
374 | 374 |
375 | 375 |
376 # TODO: this is broken. is this used? | 376 |
377 def getAllProjectsAndTagsAsCSV(self,archived=1,RESPONSE=None): | 377 |
378 """alle projekte auch die nicht getaggten""" | |
379 retList=[] | |
380 headers=['projectId','sortingNumber','projectName','scholars','startedAt','completedAt','lastChangeThesaurusAt','lastChangeProjectAt','projectCreatedAt','persons','places','objects'] | |
381 headers.extend(list(self.thesaurus.tags.keys())) | |
382 retList.append("\t".join(headers)) | |
383 if not hasattr(self,'thesaurus'): | |
384 return "NON thesaurus (there have to be a MPIWGthesaurus object, with object ID thesaurus)" | |
385 | |
386 projectTags = self.thesaurus.getProjectsAndTags() | |
387 for project in self.getProjectFields('WEB_title_or_short'): | |
388 proj = project[0] | |
389 p_name = project[1] | |
390 retProj=[] | |
391 #if (not proj.isArchivedProject() and archived==1) or (proj.isArchivedProject() and archived==2): | |
392 retProj.append(self.utf8ify(proj.getId())) | |
393 retProj.append(self.utf8ify(proj.getContent('xdata_05'))) | |
394 retProj.append(self.utf8ify(p_name)) | |
395 retProj.append(self.utf8ify(proj.getContent('xdata_01'))) | |
396 retProj.append(self.utf8ify(proj.getStartedAt())) | |
397 retProj.append(self.utf8ify(proj.getCompletedAt())) | |
398 changeDate=self.thesaurus.lastChangeInThesaurus.get(proj.getId(),'') | |
399 n = re.sub("[:\- ]","",str(changeDate)) | |
400 retProj.append(n) | |
401 retProj.append(self.utf8ify(getattr(proj,'creationTime','20050101000000'))) | |
402 retProj.append("")#TODO: project created at | |
403 retProj.append(";".join([person[1] for person in self.thesaurus.getPersonsFromProject(proj.getId())])) | |
404 retProj.append(";".join([person[1] for person in self.thesaurus.getHistoricalPlacesFromProject(proj.getId())])) | |
405 retProj.append(";".join([person[1] for person in self.thesaurus.getObjectsFromProject(proj.getId())])) | |
406 retProj+=self.thesaurus.getTags(proj.getId(),projectTags) | |
407 retList.append("\t".join(retProj)) | |
408 | |
409 if RESPONSE: | |
410 | |
411 RESPONSE.setHeader('Content-Disposition','attachment; filename="ProjectsAndTags.tsv"') | |
412 RESPONSE.setHeader('Content-Type', "application/octet-stream") | |
413 | |
414 return "\n".join(retList); | |
415 | |
416 | |
417 |