Mercurial > hg > MPIWGThesaurus
changeset 25:1456ddf7583e
getAllProjectsAndTags changed
author | dwinter |
---|---|
date | Thu, 01 Mar 2012 08:44:16 +0100 |
parents | 319b57c70203 |
children | 8731a74ed13c |
files | MPIWGThesaurus.py |
diffstat | 1 files changed, 44 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/MPIWGThesaurus.py Wed Feb 29 20:05:28 2012 +0100 +++ b/MPIWGThesaurus.py Thu Mar 01 08:44:16 2012 +0100 @@ -270,7 +270,8 @@ projs=[projs] for proj in projs: - + if proj is None: + continue projectID=proj[0] logging.debug("PTS"+repr(projectTags)) project=projectTags.get(projectID,projectHolder(projectID)) @@ -728,40 +729,54 @@ - def getTags(self,projectID,RESPONSE=None): + def getTags(self,projectID,projectTags,RESPONSE=None): """get all selected tagList""" - - logging.debug("asking:"+projectID) + #projectTags = self.getProjectsAndTags() + logging.debug(projectTags) - - apps = self.getApproaches()+ self.getDisciplines(); - retList=[] + project = projectTags.get(projectID) + if project is None: + project = projectTags.get("/en/research/projects/"+projectID) #TODO fix this projectTag list from getProjectsAndTags()contains fullpath + if project is None: + return [] + retarray=[] for tagType in self.tags.keys(): - - logging.debug("asking tag::"+repr(tagType)) + tags = project.tags.get(tagType,['']) + retarray.append(self.utf8ify(";".join(tags))) - tags = getattr(self,"tags",None) - if tags is None: - continue; - tagsStored=tags.get(tagType,None) - if tagsStored is None: - continue; - - for tag in tagsStored.keys(): #gehe durch alle gespeichteren approached - logging.debug("checking:"+tag) - currentTag = tagsStored.get(tag,None) - if currentTag is None: - continue - if currentTag.has_key(projectID): - retList.append(""" "%s" """%tag) - - if RESPONSE: - RESPONSE.setHeader('Content-Type', "application/json") - - logging.debug(retList) - return retList + return retarray +# logging.debug("asking:"+projectID) +# +# +# apps = self.getApproaches()+ self.getDisciplines(); +# retList=[] +# for tagType in self.tags.keys(): +# +# logging.debug("asking tag::"+repr(tagType)) +# +# tags = getattr(self,"tags",None) +# if tags is None: +# continue; +# +# tagsStored=tags.get(tagType,None) +# if tagsStored is None: +# continue; +# +# for tag in tagsStored.keys(): #gehe durch alle gespeichteren approached +# logging.debug("checking:"+tag) +# currentTag = tagsStored.get(tag,None) +# if currentTag is None: +# continue +# if currentTag.has_key(projectID): +# retList.append(""" "%s" """%tag) +# +# if RESPONSE: +# RESPONSE.setHeader('Content-Type', "application/json") +# +# logging.debug(retList) +# return retList def getDisciplines(self):