Mercurial > hg > MPIWGWeb
comparison MPIWGRoot.py @ 75:df56982ecb03
styles for hierarchical project list. some cleanup.
author | casties |
---|---|
date | Mon, 06 May 2013 20:04:00 +0200 |
parents | 5cb46852ac05 |
children | faaded775a8a |
comparison
equal
deleted
inserted
replaced
74:e424b68244c8 | 75:df56982ecb03 |
---|---|
158 """returns a list of the last num Features""" | 158 """returns a list of the last num Features""" |
159 dir = getattr(self, 'features', None) | 159 dir = getattr(self, 'features', None) |
160 if dir is None: | 160 if dir is None: |
161 return [] | 161 return [] |
162 | 162 |
163 items = dir.objectValues(spec='MPIWGFeature')[:] | 163 items = dir.objectValues(spec='MPIWGFeature') |
164 items.sort(key=lambda x:int(x.weight)) | 164 items.sort(key=lambda x:int(x.weight)) |
165 if num is not None: | 165 if num is not None: |
166 # take only the last num elements | 166 # take only the last num elements |
167 items = items[-num:] | 167 items = items[-num:] |
168 return items | 168 return items |
172 """returns a list of the Departments""" | 172 """returns a list of the Departments""" |
173 dir = getattr(self, 'departments', None) | 173 dir = getattr(self, 'departments', None) |
174 if dir is None: | 174 if dir is None: |
175 return [] | 175 return [] |
176 | 176 |
177 items = dir.objectValues(spec='MPIWGDepartment')[:] | 177 items = dir.objectValues(spec='MPIWGDepartment') |
178 items.sort(key=lambda x:int(x.weight)) | 178 items.sort(key=lambda x:int(x.weight)) |
179 return items | 179 return items |
180 | 180 |
181 | 181 |
182 def getDepartment(self, projectNumber=None): | 182 def getDepartment(self, projectNumber=None): |