# HG changeset patch # User dwinter # Date 1382618782 -7200 # Node ID cfb5bb05253a78afaf373b8fc18f78324c5767bc # Parent 0b58b298ef44bfdacd1614ea40bd2d69badc4aa8 direct oeffne des thesaurus mit neuem parameter open diff -r 0b58b298ef44 -r cfb5bb05253a MPIWGThesaurus.py --- a/MPIWGThesaurus.py Wed Jun 12 16:06:57 2013 +0200 +++ b/MPIWGThesaurus.py Thu Oct 24 14:46:22 2013 +0200 @@ -645,6 +645,16 @@ def getTitle(self,entry): return entry.title + def thes_quote(self,txt): + import md5 + logging.debug("@*%s*@"%txt) + return md5.md5(txt.lower()).hexdigest() + + + def formatTag(self,tag): + splitted= tag.split("_") + return splitted[-1] + def getEntriesFormatted(self,entries,formatType): if not hasattr(self,'levelFormatted'): pt=PageTemplateFile('zpt/levelFormatted', globals()).__of__(self) @@ -657,7 +667,7 @@ #return self.levelFormatted(level1_entries=entries,type=formatType) def getEntries(self,entry): - logging.debug("GETENTRY:"+repr(entry)) + #logging.debug("GETENTRY:"+repr(entry)) return entry.entries #nimmt ein eine Text der Form @@ -702,10 +712,47 @@ return self.tagList + def getTagsAsHash(self,projectID,tagType=None): + """get all tags""" + retHash={} + + tags = getattr(self,"tags",None) + + if tags is None: + return; + + #falls nicht gesetzt + if tagType is None: + tagTypes = tags.keys() + else: + tagTypes = [tagType] + + for tagType in tagTypes: + retHash[tagType]=[] + tagsStored=tags.get(tagType,None) + + if tagsStored is None: + return; + + 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): + retHash[tagType].append("""%s"""%tag) + + logging.debug(retHash) + return retHash + + + + + def getTagsJSON(self,projectID,tagType,RESPONSE=None): """get all selected tagList""" - logging.debug("asking:"+projectID) - logging.debug("asking tag::"+tagType) + #logging.debug("asking:"+projectID) + #logging.debug("asking tag::"+tagType) retList=[] tags = getattr(self,"tags",None) if tags is None: @@ -736,7 +783,7 @@ """get all selected tagList""" #projectTags = self.getProjectsAndTags() - logging.debug(projectTags) + #logging.debug(projectTags) project = projectTags.get(projectID) if project is None: diff -r 0b58b298ef44 -r cfb5bb05253a zpt/levelFormatted.zpt --- a/zpt/levelFormatted.zpt Wed Jun 12 16:06:57 2013 +0200 +++ b/zpt/levelFormatted.zpt Thu Oct 24 14:46:22 2013 +0200 @@ -6,7 +6,7 @@