Annotation of ECHO_content/ECHO_helpers.py, revision 1.1

1.1     ! dwinter     1: def getSubCols(self,sortfield="weight"):
        !             2: 
        !             3:         subColTypes=['ECHO_collection','ECHO_externalLink','ECHO_resource']
        !             4:         ids=[]
        !             5:         for entry in self.__dict__.keys():
        !             6:             object=getattr(self,entry)
        !             7:             try:
        !             8:                 if object.meta_type in subColTypes:
        !             9:                     ids.append(object)
        !            10:                     
        !            11:             except:
        !            12:                 """nothing"""
        !            13:         try:
        !            14:             sortfield=self.sortfield
        !            15:         except:
        !            16:             """nothing"""
        !            17:             
        !            18:         tmplist=[]
        !            19:         for x in ids:
        !            20:             if hasattr(x,sortfield):
        !            21:                 try:
        !            22:                     x=int(x)
        !            23:                 except:
        !            24:                     """nothing"""
        !            25:                 tmp=getattr(x,sortfield)
        !            26:             else:
        !            27:                 tmp=10000000
        !            28:             tmplist.append((tmp,x))
        !            29:         tmplist.sort()
        !            30:         return [x for (key,x) in tmplist]

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