Annotation of MPIWGWeb/MPIWGHelper.py, revision 1.1.2.1

1.1.2.1 ! dwinter     1: definedFields=['WEB_title','xdata_01','xdata_02','xdata_03','xdata_04','xdata_05','xdata_06','xdata_07','xdata_08','xdata_09','xdata_10','xdata_11','xdata_12','xdata_13','WEB_project_header','WEB_project_description','WEB_related_pub']
        !             2: 
        !             3: checkFields = ['xdata_01']
        !             4: 
        !             5: #ersetzt logging
        !             6: def logger(txt,method,txt2):
        !             7:     """logging""" 
        !             8:     logging.info(txt+ txt2)
        !             9:                  
        !            10: def getTextFromNode(nodename):
        !            11:     
        !            12:     nodelist=nodename.childNodes
        !            13:     rc = ""
        !            14:     for node in nodelist:
        !            15:         if node.nodeType == node.TEXT_NODE:
        !            16:            rc = rc + node.data
        !            17:     return rc
        !            18: 
        !            19: 
        !            20: def sortStopWordsF(self,xo,yo):
        !            21:     if not hasattr(self,'_v_stopWords'):
        !            22:         self._v_stopWords=self.stopwords_en.data.split("\n")
        !            23:     
        !            24:     x=str(xo[1])
        !            25:     y=str(yo[1])
        !            26:     
        !            27:     strx=x.split(" ")
        !            28:     stry=y.split(" ")
        !            29:     
        !            30:     for tmp in strx:
        !            31:         if tmp.lower() in self._v_stopWords:
        !            32:             del strx[strx.index(tmp)]
        !            33:     
        !            34:     for tmp in stry:
        !            35:         if tmp.lower() in self._v_stopWords:
        !            36:             del stry[stry.index(tmp)]
        !            37:             
        !            38:     return cmp(" ".join(strx)," ".join(stry))
        !            39:     
        !            40: def sortStopWords(self):
        !            41:     return lambda x,y : sortStopWordsF(self,x,y)
        !            42:     
        !            43: def sortF(x,y):
        !            44:     try:
        !            45:         return cmp(x[1],y[1])
        !            46:     except:
        !            47:         try:
        !            48:             return cmp(str(x[1]),str(y[1]))
        !            49:         except:           
        !            50:             
        !            51:             return 0 
        !            52:     
        !            53: def sortI(x,y):
        !            54:     xsplit=x[1].split(".")
        !            55:     ysplit=y[1].split(".")
        !            56:     xret=""
        !            57:     yret=""
        !            58:     try:
        !            59:         for i in range(5):
        !            60:             try:
        !            61:                 yret=yret+"%04i"%int(xsplit[i])
        !            62:             except:
        !            63:                 yret=yret+"%04i"%0
        !            64: 
        !            65:             try:
        !            66:                 xret=xret+"%04i"%int(ysplit[i])
        !            67:             except:
        !            68:                 xret=xret+"%04i"%0
        !            69:                 
        !            70:         
        !            71:         return cmp(int(yret),int(xret))
        !            72:     except:
        !            73:         return cmp(x[1],y[1])
        !            74: 
        !            75: 
        !            76: def unicodify(str):
        !            77:     """decode str (utf-8 or latin-1 representation) into unicode object"""
        !            78:     if not str:
        !            79:         return ""
        !            80:     if type(str) is StringType:
        !            81:         try:
        !            82:             return str.decode('utf-8')
        !            83:         except:
        !            84:             return str.decode('latin-1')
        !            85:     else:
        !            86:         return str
        !            87: 
        !            88: def utf8ify(str):
        !            89:     """encode unicode object or string into byte string in utf-8 representation"""
        !            90:     if not str:
        !            91:         return ""
        !            92:     if type(str) is StringType:
        !            93:         return str
        !            94:     else:
        !            95:         return str.encode('utf-8')
        !            96: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>